Runtime fixes for QT4 support.

This commit is contained in:
Neel Patel 2016-02-23 09:10:49 +00:00 committed by Dave Page
parent 2de7b4c0a0
commit 3b7886e61e
6 changed files with 23 additions and 8 deletions

View File

@ -197,7 +197,7 @@ int BrowserWindow::findURLTab(const QUrl &name)
{
webviewPtr = dynamic_cast<WebViewWindow*>(widgetPtr);
if (webviewPtr != NULL && !QString::compare(webviewPtr->getFirstLoadURL(),name.url(), Qt::CaseInsensitive))
if (webviewPtr != NULL && !QString::compare(webviewPtr->getFirstLoadURL(),name.host(), Qt::CaseInsensitive))
{
m_tabWidget->setCurrentIndex(tabCount);
return 1;
@ -412,7 +412,7 @@ void BrowserWindow::urlLinkClicked(const QUrl &name)
m_tabWidget->tabBar()->setTabButton((m_tabWidget->count() - 1), QTabBar::LeftSide, m_widget);
m_tabWidget->tabBar()->setTabButton((m_tabWidget->count() - 1), QTabBar::RightSide, m_btnClose);
m_addNewWebView->setFirstLoadURL(name.url());
m_addNewWebView->setFirstLoadURL(name.host());
m_addNewWebView->setTabIndex((m_tabWidget->count() - 1));
m_addNewWebView->setUrl(name);
}

View File

@ -14,6 +14,7 @@
// App headers
#include "TabWindow.h"
#include <QWebHistory>
TabWindow::TabWindow(QWidget *parent) :
QTabWidget(parent)

View File

@ -14,7 +14,11 @@
#include "pgAdmin4.h"
#if QT_VERSION >= 0x050000
#include <QtWebKitWidgets>
#else
#include <QWebView>
#endif
class WebViewWindow : public QWebView
{

View File

@ -29,6 +29,17 @@
#include "ConfigWindow.h"
#include "Server.h"
#include <QTime>
void delay( int milliseconds )
{
QTime endTime = QTime::currentTime().addMSecs( milliseconds );
while( QTime::currentTime() < endTime )
{
QCoreApplication::processEvents( QEventLoop::AllEvents, 100 );
}
}
int main(int argc, char * argv[])
{
// Create the QT application
@ -47,8 +58,8 @@ int main(int argc, char * argv[])
// Hence - putting this code in a code block so the scope of the socket
// variable vanishes to make that socket available.
{
QTcpSocket socket;
socket.bind(0, QAbstractSocket::DontShareAddress);
QUdpSocket socket;
socket.bind(0, QUdpSocket::ShareAddress);
port = socket.localPort();
}
@ -69,7 +80,7 @@ int main(int argc, char * argv[])
// This is a hack. Wait a second and then check to see if the server thread
// is still running. If it's not, we probably had a startup error
QThread::sleep(1);
delay(1000);
// Any errors?
if (server->isFinished() || server->getError().length() > 0)
@ -127,7 +138,7 @@ int main(int argc, char * argv[])
exit(1);
}
QThread::sleep(1);
delay(1000);
}
// Create & show the main window

View File

@ -23,6 +23,7 @@
#include <QtWidgets>
#else
#include <QApplication>
#include <QtGui>
#include <Qt/qurl.h>
#endif

View File

@ -71,8 +71,6 @@ FORMS = BrowserWindow.ui \
ICON = pgAdmin4.icns
QMAKE_INFO_PLIST = Info.plist
cache()
RESOURCES += \
pgadmin4.qrc