Further UI improvements for the runtime.

This commit is contained in:
Dave Page 2016-01-22 14:21:34 +00:00
parent c421bef0d0
commit af742011a5
3 changed files with 60 additions and 10 deletions

View File

@ -63,10 +63,6 @@ BrowserWindow::BrowserWindow(QString url)
m_tabWidget->setTabText(0, PGA_APP_NAME);
m_tabWidget->setTabToolTipText(0, PGA_APP_NAME) ;
#ifndef __APPLE__
m_tabWidget->setStyleSheet("QTabBar::tab{max-height:24px;max-width:250px;}");
#endif
setCentralWidget(m_tabWidget);
connect(m_mainWebView, SIGNAL(loadFinished(bool)), SLOT(finishLoading(bool)));
@ -364,24 +360,25 @@ void BrowserWindow::urlLinkClicked(const QUrl &name)
m_widget = new QWidget(m_addNewTab);
m_toolBtnBack = new QToolButton(m_widget);
m_toolBtnBack->setFixedHeight(16);
m_toolBtnBack->setFixedWidth(16);
m_toolBtnBack->setFixedHeight(PGA_BTN_SIZE);
m_toolBtnBack->setFixedWidth(PGA_BTN_SIZE);
m_toolBtnBack->setText(PGA_BTN_BACK);
m_toolBtnBack->setDisabled(true);
m_toolBtnForward = new QToolButton(m_widget);
m_toolBtnForward->setFixedHeight(16);
m_toolBtnForward->setFixedWidth(16);
m_toolBtnForward->setFixedHeight(PGA_BTN_SIZE);
m_toolBtnForward->setFixedWidth(PGA_BTN_SIZE);
m_toolBtnForward->setText(PGA_BTN_FORWARD);
m_toolBtnForward->setDisabled(true);
QPushButton *m_btnClose = new QPushButton(m_widget);
m_btnClose->setText(PGA_BTN_CLOSE);
m_btnClose->setFixedHeight(16);
m_btnClose->setFixedWidth(16);
m_btnClose->setFixedHeight(PGA_BTN_SIZE);
m_btnClose->setFixedWidth(PGA_BTN_SIZE);
m_horizontalLayout = new QHBoxLayout(m_widget);
m_horizontalLayout->setSizeConstraint(QLayout::SetMinAndMaxSize);
m_horizontalLayout->setSpacing(1);
m_horizontalLayout->addWidget(m_toolBtnBack);
m_horizontalLayout->addWidget(m_toolBtnForward);

View File

@ -21,11 +21,51 @@ TabWindow::TabWindow(QWidget *parent) :
setParent(parent);
setTabsClosable(false);
setElideMode(Qt::ElideRight);
// Get the system colours we need
QPalette palette = QApplication::palette("QPushButton");
QColor activebg = palette.color(QPalette::Button);
QColor activefg = palette.color(QPalette::ButtonText);
QColor inactivebg = palette.color(QPalette::Dark);
QColor inactivefg = palette.color(QPalette::ButtonText);
QColor border = palette.color(QPalette::Mid);
setStyleSheet(
"QTabBar::tab { "
"background-color: " + inactivebg.name() + "; "
"color: " + inactivefg.name() + "; "
"border: 1px solid " + border.name() + "; "
"padding: 1px 0px; "
"margin-left: 0px; "
"margin-top: 1px; "
#ifndef __APPLE__
"width: 15em; "
#ifdef _WIN32
"height: 1.5em; "
#else
"height: 1em; "
#endif
#endif
"} "
"QTabBar::tab:selected { "
"background-color: " + activebg.name() + "; "
"color: " + activefg.name() + "; "
"border-bottom-style: none; "
"} "
"QTabWidget::pane { "
"border: 0; "
"} "
"QTabWidget::tab-bar {"
"alignment: left; "
"}"
);
#ifdef __APPLE__
m_testTabBar = new TabBar();
setTabBar(m_testTabBar);
#endif
// Hide the default tab
tabBar()->setAutoHide(true);
}
// Hide the close button of given index displayed on right side of tab

View File

@ -16,9 +16,22 @@
#include "WebViewWindow.h"
// Define button characters
#ifdef _WIN32
const QString PGA_BTN_FORWARD = QString(">");
const QString PGA_BTN_BACK = QString("<");
const QString PGA_BTN_CLOSE = QString("x");
#else
const QString PGA_BTN_FORWARD = QString("\u2192");
const QString PGA_BTN_BACK = QString("\u2190");
const QString PGA_BTN_CLOSE = QString("\u2715");
#endif
// Define button sizes
#ifdef _WIN32
const int PGA_BTN_SIZE = 18;
#else
const int PGA_BTN_SIZE = 16;
#endif
class TabBar : public QTabBar
{