Fix runtime support under Qt4

This commit is contained in:
Neel Patel 2017-06-16 11:26:31 +01:00 committed by Dave Page
parent 1ee555e468
commit a21dad4c45
3 changed files with 15 additions and 7 deletions

View File

@ -25,6 +25,9 @@ DockTabWidget *DockTabWidget::mainTabWidget = NULL;
DockTabWidget::DockTabWidget(QWidget *parent) :
QTabWidget(parent)
{
floatingWidget = NULL;
floatingEnabled = false;
setParent(parent);
setTabsClosable(false);
setElideMode(Qt::ElideRight);
@ -512,6 +515,7 @@ DockTabBar::DockTabBar(DockTabWidget *tabWidget, QWidget *parent) :
QTabBar(parent),
tab_widget(tabWidget)
{
isStartingDrag = false;
setAcceptDrops(true);
}

View File

@ -90,8 +90,8 @@ public slots:
void tabIndexChanged(int index);
private:
QWidget *floatingWidget = 0;
bool floatingEnabled = false;
QWidget *floatingWidget;
bool floatingEnabled;
};
class DockTabBar : public QTabBar
@ -115,6 +115,7 @@ protected:
void dropEvent(QDropEvent *event);
void dragLeaveEvent(QDragLeaveEvent * event);
// re-implemented paint event to draw the text on tab bar of tab widget control.
void paintEvent(QPaintEvent *event)
{
Q_UNUSED(event);
@ -144,20 +145,21 @@ protected:
QRect rect(option.rect);
// If toolButton is visible then only draw text after tool button pixel area.
// If tool button is not visible - draw the text after margin of 10px.
if (isToolBtnVisible)
{
if ((current_index != -1) && i == current_index)
{
if (str.startsWith("Query -") || str.startsWith("Debugger"))
rect.setX(option.rect.x() + 5);
rect.setX(option.rect.x() + 10);
else
rect.setX(option.rect.x() + 45);
}
else
rect.setX(option.rect.x() + 5);
rect.setX(option.rect.x() + 10);
}
else
rect.setX(option.rect.x() + 5);
rect.setX(option.rect.x() + 10);
rect.setY(option.rect.y() + 7);
@ -178,8 +180,8 @@ protected:
private:
int insertionIndexAt(const QPoint &pos);
DockTabWidget *tab_widget = 0;
bool isStartingDrag = false;
DockTabWidget *tab_widget;
bool isStartingDrag;
QPoint dragStartPos;
};

View File

@ -183,8 +183,10 @@ int main(int argc, char * argv[])
QCoreApplication::setOrganizationDomain("pgadmin.org");
QCoreApplication::setApplicationName(PGA_APP_NAME.toLower().replace(" ", ""));
#if QT_VERSION >= 0x050000
// Set high DPI pixmap to display icons clear on Qt widget.
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif
/* In windows and linux, it is required to set application level proxy
* becuase socket bind logic to find free port gives socket creation error