mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-07 03:30:44 +00:00
Retina display support for Qt5.2 beta, build 3rdparty libs in on mac
This commit is contained in:
parent
c58bfbbf8e
commit
1ba1511118
@ -2086,7 +2086,11 @@ void gGraphView::DrawTextQue(QPainter &painter)
|
|||||||
painter.setRenderHint(QPainter::TextAntialiasing,q.antialias);
|
painter.setRenderHint(QPainter::TextAntialiasing,q.antialias);
|
||||||
|
|
||||||
if (q.angle==0) { // normal text
|
if (q.angle==0) { // normal text
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
painter.drawText(q.x*devicePixelRatio(),q.y*devicePixelRatio(),q.text);
|
||||||
|
#else
|
||||||
painter.drawText(q.x,q.y,q.text);
|
painter.drawText(q.x,q.y,q.text);
|
||||||
|
#endif
|
||||||
} else { // rotated text
|
} else { // rotated text
|
||||||
w=painter.fontMetrics().width(q.text);
|
w=painter.fontMetrics().width(q.text);
|
||||||
h=painter.fontMetrics().xHeight()+2;
|
h=painter.fontMetrics().xHeight()+2;
|
||||||
@ -2136,6 +2140,10 @@ QImage gGraphView::fboRenderPixmap(int w,int h)
|
|||||||
if (fbo_unsupported)
|
if (fbo_unsupported)
|
||||||
return pm;
|
return pm;
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
w*=devicePixelRatio();
|
||||||
|
h*=devicePixelRatio();
|
||||||
|
#endif
|
||||||
|
|
||||||
if ((w > max_fbo_width) || (h > max_fbo_height)) {
|
if ((w > max_fbo_width) || (h > max_fbo_height)) {
|
||||||
qWarning() << "gGraphView::fboRenderPixmap called with dimensiopns exceeding maximum frame buffer object size";
|
qWarning() << "gGraphView::fboRenderPixmap called with dimensiopns exceeding maximum frame buffer object size";
|
||||||
@ -2578,35 +2586,47 @@ void gGraphView::DrawTextQue()
|
|||||||
painter.drawText(2,h,q.text);
|
painter.drawText(2,h,q.text);
|
||||||
painter.end();
|
painter.end();
|
||||||
|
|
||||||
pc->image=QGLWidget::convertToGLFormat(pm);
|
pc->image=pm;// QGLWidget::convertToGLFormat(pm);
|
||||||
pixmap_cache_size+=pm.width()*pm.height()*(pm.depth()/8);
|
pixmap_cache_size+=pm.width()*pm.height()*(pm.depth()/8);
|
||||||
pc->textureID=bindTexture(pc->image,GL_TEXTURE_2D,GL_RGBA,QGLContext::NoBindOption);
|
pc->textureID=bindTexture(pc->image,GL_TEXTURE_2D,GL_RGBA,QGLContext::NoBindOption);
|
||||||
pixmap_cache[hstr]=pc;
|
pixmap_cache[hstr]=pc;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (pc) {
|
if (pc) {
|
||||||
|
painter.begin(this);
|
||||||
pc->last_used=ti;
|
pc->last_used=ti;
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
//glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
//glEnable(GL_TEXTURE_2D);
|
//glEnable(GL_TEXTURE_2D);
|
||||||
if (q.angle!=0) {
|
if (q.angle!=0) {
|
||||||
glPushMatrix();
|
// glPushMatrix();
|
||||||
glTranslatef(q.x-pc->image.height()-(pc->image.height()/2),q.y+pc->image.width()/2 + pc->image.height()/2, 0);
|
// glTranslatef(q.x-pc->image.height()-(pc->image.height()/2),q.y+pc->image.width()/2 + pc->image.height()/2, 0);
|
||||||
glRotatef(-q.angle,0,0,1);
|
// glRotatef(-q.angle,0,0,1);
|
||||||
drawTexture(QPoint(0,pc->image.height()/2),pc->textureID);
|
// drawTexture(QPoint(0,pc->image.height()/2),pc->textureID);
|
||||||
glPopMatrix();
|
// glPopMatrix();
|
||||||
|
|
||||||
|
float xxx=q.x-pc->image.height()-(pc->image.height()/2);
|
||||||
|
float yyy=q.y+pc->image.width()/2 + pc->image.height()/2;
|
||||||
|
painter.translate(xxx,yyy);
|
||||||
|
painter.rotate(-q.angle);
|
||||||
|
painter.drawImage(QPoint(0,pc->image.height()/2),pc->image);
|
||||||
|
painter.rotate(+q.angle);
|
||||||
|
painter.translate(-xxx, -yyy);
|
||||||
|
|
||||||
//glTranslatef(marginLeft()+4,originY+height/2+x/2, 0);
|
//glTranslatef(marginLeft()+4,originY+height/2+x/2, 0);
|
||||||
//glRotatef(-90,0,0,1);
|
//glRotatef(-90,0,0,1);
|
||||||
//m_graphview->drawTexture(QPoint(0,y/2),titleImageTex);
|
//m_graphview->drawTexture(QPoint(0,y/2),titleImageTex);
|
||||||
} else {
|
} else {
|
||||||
|
painter.drawImage(q.x,q.y-pc->image.height()+4,pc->image);
|
||||||
// TODO: setup for rotation if angle specified.
|
// TODO: setup for rotation if angle specified.
|
||||||
drawTexture(QPoint(q.x,q.y-pc->image.height()+4),pc->textureID);
|
//drawTexture(QPoint(q.x,q.y-pc->image.height()+4),pc->textureID);
|
||||||
}
|
}
|
||||||
// glDisable(GL_TEXTURE_2D);
|
// glDisable(GL_TEXTURE_2D);
|
||||||
glDisable(GL_BLEND);
|
// glDisable(GL_BLEND);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -2937,7 +2957,11 @@ void gGraphView::resizeGL(int w, int h)
|
|||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
glOrtho(0, w/devicePixelRatio(), h/devicePixelRatio(), 0, -1, 1);
|
||||||
|
#else
|
||||||
glOrtho(0, w, h, 0, -1, 1);
|
glOrtho(0, w, h, 0, -1, 1);
|
||||||
|
#endif
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
}
|
}
|
||||||
@ -2948,6 +2972,11 @@ void gGraphView::renderSomethingFun(float alpha)
|
|||||||
// glPushMatrix();
|
// glPushMatrix();
|
||||||
float w=width();
|
float w=width();
|
||||||
float h=height();
|
float h=height();
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
w*=devicePixelRatio();
|
||||||
|
h*=devicePixelRatio();
|
||||||
|
#endif
|
||||||
|
|
||||||
glViewport(0, 0, w, h);
|
glViewport(0, 0, w, h);
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
@ -657,8 +657,12 @@ void gLineChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
//DrawText(w,msg,left+(width/2.0)-(x/2.0),scry-w.GetBottomMargin()-height/2.0+y/2.0,0,Qt::gray,bigfont);
|
//DrawText(w,msg,left+(width/2.0)-(x/2.0),scry-w.GetBottomMargin()-height/2.0+y/2.0,0,Qt::gray,bigfont);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
float dpr=w.graphView()->devicePixelRatio();
|
||||||
|
lines->scissor(left*dpr,w.flipY(top+height+2)*dpr,(width+1)*dpr,(height+1)*dpr);
|
||||||
|
#else
|
||||||
lines->scissor(left,w.flipY(top+height+2),width+1,height+1);
|
lines->scissor(left,w.flipY(top+height+2),width+1,height+1);
|
||||||
//lines->draw();
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -745,7 +749,12 @@ void AHIChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
lastpy=py;
|
lastpy=py;
|
||||||
if (done) break;
|
if (done) break;
|
||||||
}
|
}
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
float dpr=w.graphView()->devicePixelRatio();
|
||||||
|
lines->scissor(left*dpr,w.flipY(top+height+2)*dpr,(width+1)*dpr,(height+1)*dpr);
|
||||||
|
#else
|
||||||
lines->scissor(left,w.flipY(top+height+2),width+1,height+1);
|
lines->scissor(left,w.flipY(top+height+2),width+1,height+1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void AHIChart::SetDay(Day *d)
|
void AHIChart::SetDay(Day *d)
|
||||||
|
@ -580,9 +580,12 @@ jumpnext:
|
|||||||
daynum++;
|
daynum++;
|
||||||
//lastQ=Q;
|
//lastQ=Q;
|
||||||
}
|
}
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
float dpr=w.graphView()->devicePixelRatio();
|
||||||
|
lines->scissor(left*dpr,w.flipY(top+height+2)*dpr,(width+1)*dpr,(height+1)*dpr);
|
||||||
|
#else
|
||||||
lines->scissor(left,w.flipY(top+height+2),width+1,height+2);
|
lines->scissor(left,w.flipY(top+height+2),width+1,height+2);
|
||||||
|
#endif
|
||||||
// Draw Ledgend
|
// Draw Ledgend
|
||||||
px=left+width-3;
|
px=left+width-3;
|
||||||
py=top-5;
|
py=top-5;
|
||||||
|
@ -1246,13 +1246,15 @@ void Daily::Load(QDate date)
|
|||||||
html+=QString("<tr><td align=center><b>%1</b></td></tr>").arg(tr("Event Breakdown"));
|
html+=QString("<tr><td align=center><b>%1</b></td></tr>").arg(tr("Event Breakdown"));
|
||||||
GAHI->setShowTitle(false);
|
GAHI->setShowTitle(false);
|
||||||
|
|
||||||
QPixmap pixmap=GAHI->renderPixmap(155,155,false);
|
int w=155;
|
||||||
|
int h=155;
|
||||||
|
QPixmap pixmap=GAHI->renderPixmap(w,h,false);
|
||||||
if (!pixmap.isNull()) {
|
if (!pixmap.isNull()) {
|
||||||
QByteArray byteArray;
|
QByteArray byteArray;
|
||||||
QBuffer buffer(&byteArray); // use buffer to store pixmap into byteArray
|
QBuffer buffer(&byteArray); // use buffer to store pixmap into byteArray
|
||||||
buffer.open(QIODevice::WriteOnly);
|
buffer.open(QIODevice::WriteOnly);
|
||||||
pixmap.save(&buffer, "PNG");
|
pixmap.save(&buffer, "PNG");
|
||||||
html += "<tr><td align=center><img src=\"data:image/png;base64," + byteArray.toBase64() + "\"></td></tr>\n";
|
html += "<tr><td align=center><img src=\"data:image/png;base64," + byteArray.toBase64() + QString("\" width='%1' height='%2px'></td></tr>\n").arg(w).arg(h);
|
||||||
} else {
|
} else {
|
||||||
html += "<tr><td align=center>Unable to display Pie Chart on this system</td></tr>\n";
|
html += "<tr><td align=center>Unable to display Pie Chart on this system</td></tr>\n";
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@ greaterThan(QT_MAJOR_VERSION,4) {
|
|||||||
CONFIG += rtti
|
CONFIG += rtti
|
||||||
|
|
||||||
win32:CONFIG += use_bundled_libs
|
win32:CONFIG += use_bundled_libs
|
||||||
else:!use_bundled_libs:CONFIG += extserialport
|
|
||||||
|
|
||||||
use_bundled_libs:DEFINES += USE_BUNDLED_LIBS
|
use_bundled_libs:DEFINES += USE_BUNDLED_LIBS
|
||||||
|
|
||||||
@ -231,7 +230,9 @@ mac {
|
|||||||
|
|
||||||
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../3rdparty/quazip/quazip/release/ -lquazip
|
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../3rdparty/quazip/quazip/release/ -lquazip
|
||||||
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../3rdparty/quazip/quazip/debug/ -lquazip
|
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../3rdparty/quazip/quazip/debug/ -lquazip
|
||||||
else:unix {
|
else:mac {
|
||||||
|
include(../3rdparty/quazip/quazip/quazip.pri)
|
||||||
|
} else:unix {
|
||||||
use_bundled_libs:QMAKE_LFLAGS += -L$$OUT_PWD/../3rdparty/quazip/
|
use_bundled_libs:QMAKE_LFLAGS += -L$$OUT_PWD/../3rdparty/quazip/
|
||||||
else:QMAKE_LFLAGS += -L/usr/lib -L/usr/local/lib
|
else:QMAKE_LFLAGS += -L/usr/lib -L/usr/local/lib
|
||||||
|
|
||||||
@ -262,5 +263,6 @@ use_bundled_libs: {
|
|||||||
INCLUDEPATH += $$PWD/../3rdparty/qextserialport
|
INCLUDEPATH += $$PWD/../3rdparty/qextserialport
|
||||||
DEPENDPATH += $$PWD/../3rdparty/qextserialport
|
DEPENDPATH += $$PWD/../3rdparty/qextserialport
|
||||||
} else {
|
} else {
|
||||||
CONFIG += extserialport
|
mac:include(../3rdparty/qextserialport/src/qextserialport.pri)
|
||||||
|
else:CONFIG += extserialport
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user