diff --git a/src/libs/qmljsdebugger/editor/crumblepath.cpp b/src/libs/qmljsdebugger/editor/crumblepath.cpp index 4fdbfefc49d369072c7d4e78ef88e765c42eaf51..00666cf5d2a9a44f7f99063229f975efbbdc7b2b 100644 --- a/src/libs/qmljsdebugger/editor/crumblepath.cpp +++ b/src/libs/qmljsdebugger/editor/crumblepath.cpp @@ -57,11 +57,10 @@ private: CrumblePathButton::CrumblePathButton(const QString &title, QWidget *parent) : QPushButton(title, parent) { - setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); + setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); setToolTip(title); setMinimumHeight(24); setMaximumHeight(24); - setStyleSheet(lastSegmentSheet(true)); } @@ -119,10 +118,14 @@ void CrumblePathButton::setSegmentType(int type) // CrumblePath // CrumblePath::CrumblePath(QWidget *parent) : - QWidget(parent) + QWidget(parent), m_background(new QWidget(this)) { - setMinimumHeight(24); - setMaximumHeight(24); + setMinimumHeight(25); + setMaximumHeight(25); + setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum); + + m_background->setStyleSheet("QWidget { background-color:#2d2d2d;}"); + m_background->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); } CrumblePath::~CrumblePath() @@ -159,12 +162,13 @@ void CrumblePath::popElement() last->setParent(0); last->deleteLater(); - int segType = CrumblePathButton::MiddleSegment; + int segType = CrumblePathButton::MiddleSegment | CrumblePathButton::LastSegment; if (!m_buttons.isEmpty()) { if (m_buttons.length() == 1) segType = CrumblePathButton::FirstSegment | CrumblePathButton::LastSegment; m_buttons.last()->setSegmentType(segType); } + resizeButtons(); } void CrumblePath::clear() @@ -181,33 +185,45 @@ void CrumblePath::resizeEvent(QResizeEvent *) void CrumblePath::resizeButtons() { - int buttonWidth = 0; - if (m_buttons.length() > 1) { + int buttonMinWidth = 0; + int buttonMaxWidth = 0; + int totalWidthLeft = width(); + + if (m_buttons.length() >= 1) { QPoint nextElementPosition(0,0); m_buttons[0]->raise(); // rearrange all items so that the first item is on top (added last). for(int i = 0; i < m_buttons.length() ; ++i) { - QWidget *button = m_buttons[i]; - buttonWidth = (width() + ArrowBorderSize * m_buttons.length()) / m_buttons.length(); - button->setMaximumWidth(buttonWidth); - button->setGeometry(QRect(nextElementPosition, QSize(buttonWidth, button->height()))); + CrumblePathButton *button = m_buttons[i]; + + QFontMetrics fm(button->font()); + buttonMinWidth = ArrowBorderSize + fm.width(button->text()) + ArrowBorderSize * 2 ; + buttonMaxWidth = (totalWidthLeft + ArrowBorderSize * (m_buttons.length() - i)) / (m_buttons.length() - i); + + if (buttonMinWidth > buttonMaxWidth && i < m_buttons.length() - 1) { + buttonMinWidth = buttonMaxWidth; + } else if (i > 3 && (i == m_buttons.length() - 1)) { + buttonMinWidth = width() - nextElementPosition.x(); + buttonMaxWidth = buttonMinWidth; + } + + button->setMinimumWidth(buttonMinWidth); + button->setMaximumWidth(buttonMaxWidth); + button->move(nextElementPosition); nextElementPosition.rx() += button->width() - ArrowBorderSize; + totalWidthLeft -= button->width(); button->show(); if (i > 0) button->stackUnder(m_buttons[i - 1]); } - } else if (m_buttons.length() == 1) { - QWidget *button = m_buttons[0]; - int buttonWidth = 2 * width() / (3 * m_buttons.length()); - - button->setMaximumWidth(buttonWidth); - button->setGeometry(QRect(QPoint(0, 0), QSize(buttonWidth, button->height()))); - button->show(); } + + m_background->setGeometry(0,0, width(), height()); + m_background->update(); } void CrumblePath::mapClickToIndex() diff --git a/src/libs/qmljsdebugger/editor/editor.qrc b/src/libs/qmljsdebugger/editor/editor.qrc index 0e72b9a097374697c65b93577f49b9d75465164f..c3fa47c28912e984f84c66fdb0b93d06a7f86c23 100644 --- a/src/libs/qmljsdebugger/editor/editor.qrc +++ b/src/libs/qmljsdebugger/editor/editor.qrc @@ -16,5 +16,6 @@ <file>images/segment-hover-end.png</file> <file>images/segment-hover.png</file> <file>images/segment-selected-end.png</file> + <file>images/color-picker-hicontrast.png</file> </qresource> </RCC> diff --git a/src/libs/qmljsdebugger/editor/images/color-picker-hicontrast.png b/src/libs/qmljsdebugger/editor/images/color-picker-hicontrast.png new file mode 100644 index 0000000000000000000000000000000000000000..95b88ac8f0a20ce091821002793d1cfc3302c0b2 Binary files /dev/null and b/src/libs/qmljsdebugger/editor/images/color-picker-hicontrast.png differ diff --git a/src/libs/qmljsdebugger/editor/images/color-picker.png b/src/libs/qmljsdebugger/editor/images/color-picker.png index 73d9ae3dfc40995337e3a0762831fa908e390120..026c31b3e1ddaaf4697b077ac693f3ad576b7023 100644 Binary files a/src/libs/qmljsdebugger/editor/images/color-picker.png and b/src/libs/qmljsdebugger/editor/images/color-picker.png differ diff --git a/src/libs/qmljsdebugger/editor/images/from-qml.png b/src/libs/qmljsdebugger/editor/images/from-qml.png index e3a6e24c1994c04a9a15513af6f94fd6ee159ee2..666382c06dde13aae6cf433729da5cb155cf095b 100644 Binary files a/src/libs/qmljsdebugger/editor/images/from-qml.png and b/src/libs/qmljsdebugger/editor/images/from-qml.png differ diff --git a/src/libs/qmljsdebugger/editor/images/pause.png b/src/libs/qmljsdebugger/editor/images/pause.png index c5d33a2d04b7ae11b35e88e4ef8033057a809093..114d89b12bdca29a40dd90d6004b53d00d323257 100644 Binary files a/src/libs/qmljsdebugger/editor/images/pause.png and b/src/libs/qmljsdebugger/editor/images/pause.png differ diff --git a/src/libs/qmljsdebugger/editor/images/play.png b/src/libs/qmljsdebugger/editor/images/play.png index af75fcdb6285032ce073ab90bb1648d19d372b3f..011598a746fda2fb68de10ee4233429e474b7908 100644 Binary files a/src/libs/qmljsdebugger/editor/images/play.png and b/src/libs/qmljsdebugger/editor/images/play.png differ diff --git a/src/libs/qmljsdebugger/editor/images/reload.png b/src/libs/qmljsdebugger/editor/images/reload.png new file mode 100644 index 0000000000000000000000000000000000000000..7042bec9ae9f1076acd08e9fa72fda4f51118cfe Binary files /dev/null and b/src/libs/qmljsdebugger/editor/images/reload.png differ diff --git a/src/libs/qmljsdebugger/editor/images/select-marquee.png b/src/libs/qmljsdebugger/editor/images/select-marquee.png index a28381f117653497bff3245a2712acd341b545f9..92fe40d1adc99326c9edb2c31d3dd7a042a04f0d 100644 Binary files a/src/libs/qmljsdebugger/editor/images/select-marquee.png and b/src/libs/qmljsdebugger/editor/images/select-marquee.png differ diff --git a/src/libs/qmljsdebugger/editor/images/select.png b/src/libs/qmljsdebugger/editor/images/select.png index 5b0376f6f7e0a725ff5d236a8767cf0d733eafd7..672285582b5cc30d0cfe457a20c2982e1b056a99 100644 Binary files a/src/libs/qmljsdebugger/editor/images/select.png and b/src/libs/qmljsdebugger/editor/images/select.png differ diff --git a/src/libs/qmljsdebugger/editor/images/to-qml.png b/src/libs/qmljsdebugger/editor/images/to-qml.png index 84ff48fa951f40bdc013ec8eaa71a39ad7f6f0ea..2ab951fd082096b1b3838d4e2342d302ce23518d 100644 Binary files a/src/libs/qmljsdebugger/editor/images/to-qml.png and b/src/libs/qmljsdebugger/editor/images/to-qml.png differ diff --git a/src/libs/qmljsdebugger/editor/images/zoom.png b/src/libs/qmljsdebugger/editor/images/zoom.png index 4abf31444006ba1d80eb508c24e8cd0b0606d8f8..ebae877310cc1053dd2a36af352ba077ef952d6a 100644 Binary files a/src/libs/qmljsdebugger/editor/images/zoom.png and b/src/libs/qmljsdebugger/editor/images/zoom.png differ diff --git a/src/libs/qmljsdebugger/editor/qmltoolbar.cpp b/src/libs/qmljsdebugger/editor/qmltoolbar.cpp index 333616289c05bd259f9a7cda443e0f09360c25df..14c9c7c1a60bb461bb5410a921037a13685360fa 100644 --- a/src/libs/qmljsdebugger/editor/qmltoolbar.cpp +++ b/src/libs/qmljsdebugger/editor/qmltoolbar.cpp @@ -21,7 +21,7 @@ QmlToolbar::QmlToolbar(QWidget *parent) : ui->select = new QAction(QIcon(":/qml/images/select.png"), tr("Select"), this); ui->selectMarquee = new QAction(QIcon(":/qml/images/select-marquee.png"), tr("Select (Marquee)"), this); ui->zoom = new QAction(QIcon(":/qml/images/zoom.png"), tr("Zoom"), this); - ui->colorPicker = new QAction(QIcon(":/qml/images/color-picker.png"), tr("Color Picker"), this); + ui->colorPicker = new QAction(QIcon(":/qml/images/color-picker-hicontrast.png"), tr("Color Picker"), this); ui->toQml = new QAction(QIcon(":/qml/images/to-qml.png"), tr("Apply Changes to QML Viewer"), this); ui->fromQml = new QAction(QIcon(":/qml/images/from-qml.png"), tr("Apply Changes to Document"), this); ui->designmode->setCheckable(true); @@ -47,7 +47,7 @@ QmlToolbar::QmlToolbar(QWidget *parent) : addSeparator(); addAction(ui->zoom); addAction(ui->colorPicker); - addAction(ui->fromQml); + //addAction(ui->fromQml); ui->colorBox = new ToolBarColorBox(this); ui->colorBox->setMinimumSize(24, 24); diff --git a/src/libs/qmljsdebugger/editor/toolbarcolorbox.cpp b/src/libs/qmljsdebugger/editor/toolbarcolorbox.cpp index c4d4d4e0fe18884a8143f2b0e5bf834c68f8e842..8e1b94cfdd5b757b50b1a6022c3dea5e8c48aee7 100644 --- a/src/libs/qmljsdebugger/editor/toolbarcolorbox.cpp +++ b/src/libs/qmljsdebugger/editor/toolbarcolorbox.cpp @@ -19,7 +19,7 @@ namespace QmlViewer { ToolBarColorBox::ToolBarColorBox(QWidget *parent) : QLabel(parent) { - m_copyHexColor = new QAction(tr("Copy"), this); + m_copyHexColor = new QAction(QIcon(":/qml/images/color-picker-hicontrast.png"), tr("Copy"), this); connect(m_copyHexColor, SIGNAL(triggered()), SLOT(copyColorToClipboard())); setScaledContents(false); } @@ -63,7 +63,7 @@ QPixmap ToolBarColorBox::createDragPixmap(int size) const QPainter p(&pix); QColor borderColor1 = QColor(143, 143 ,143); - QColor borderColor2 = Qt::white; + QColor borderColor2 = QColor(43, 43, 43); p.setBrush(QBrush(m_color)); p.setPen(QPen(QBrush(borderColor2),1)); diff --git a/src/libs/qmljsdebugger/include/crumblepath.h b/src/libs/qmljsdebugger/include/crumblepath.h index a8846fad9da69aac25539e5d9e29839b49e3f808..cd1f09f3b34027ffc310757356631f9cafa7823e 100644 --- a/src/libs/qmljsdebugger/include/crumblepath.h +++ b/src/libs/qmljsdebugger/include/crumblepath.h @@ -66,6 +66,7 @@ private: private: QList<CrumblePathButton*> m_buttons; + QWidget *m_background; }; } // namespace QmlViewer diff --git a/src/tools/qml/qmlobserver/qml.pri b/src/tools/qml/qmlobserver/qml.pri index c351d58caf34ca1dfc04c723d954665b8f7aeb77..7d9a503fb69d479901b5feb518ce67de5050af35 100644 --- a/src/tools/qml/qmlobserver/qml.pri +++ b/src/tools/qml/qmlobserver/qml.pri @@ -21,6 +21,8 @@ SOURCES += $$PWD/qmlruntime.cpp \ RESOURCES += $$PWD/qmlruntime.qrc +OTHER_FILES += toolbarstyle.css + maemo5 { QT += dbus HEADERS += $$PWD/texteditautoresizer_maemo5.h diff --git a/src/tools/qml/qmlobserver/qmlruntime.cpp b/src/tools/qml/qmlobserver/qmlruntime.cpp index 0109914f031579c3ba16198b9625274651aa0449..646f438869aa913afad2f70c2ad3be19a55b39c4 100644 --- a/src/tools/qml/qmlobserver/qmlruntime.cpp +++ b/src/tools/qml/qmlobserver/qmlruntime.cpp @@ -588,16 +588,23 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) canvas = new QmlViewer::QDeclarativeDesignView(this); addToolBar(Qt::TopToolBarArea, canvas->toolbar()); + QFile file(":/toolbarstyle.css"); + file.open(QFile::ReadOnly); + QString toolbarStylesheet = QLatin1String(file.readAll()); + + canvas->toolbar()->setFloatable(false); + canvas->toolbar()->setMovable(false); + canvas->toolbar()->setStyleSheet(toolbarStylesheet); + m_centralWidget = new QWidget(this); QVBoxLayout *layout = new QVBoxLayout(m_centralWidget); layout->setMargin(0); layout->setSpacing(0); layout->addWidget(canvas->crumblePathWidget()); + canvas->crumblePathWidget()->setStyleSheet("QWidget { border-bottom: 1px solid black; }"); layout->addWidget(canvas); - canvas->crumblePathWidget()->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); m_centralWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); - //canvas->setSizePolicy(Qt:); canvas->setAttribute(Qt::WA_OpaquePaintEvent); canvas->setAttribute(Qt::WA_NoSystemBackground); diff --git a/src/tools/qml/qmlobserver/qmlruntime.qrc b/src/tools/qml/qmlobserver/qmlruntime.qrc index 3a9e6080e35db272c24947e0037db614b65eea31..e8d08c6356e6617f37d50492e998eab0be37bd2a 100644 --- a/src/tools/qml/qmlobserver/qmlruntime.qrc +++ b/src/tools/qml/qmlobserver/qmlruntime.qrc @@ -1,9 +1,10 @@ <RCC> - <qresource prefix="/" > + <qresource prefix="/"> <file>content/Browser.qml</file> <file>content/images/up.png</file> <file>content/images/folder.png</file> <file>content/images/titlebar.sci</file> <file>content/images/titlebar.png</file> + <file>toolbarstyle.css</file> </qresource> </RCC> diff --git a/src/tools/qml/qmlobserver/toolbarstyle.css b/src/tools/qml/qmlobserver/toolbarstyle.css new file mode 100644 index 0000000000000000000000000000000000000000..8fbbdf9f87534d805516ad24e065e9ab73f998ab --- /dev/null +++ b/src/tools/qml/qmlobserver/toolbarstyle.css @@ -0,0 +1,28 @@ +QToolBar { + background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(85, 85, 85, 255), stop:0.3 rgba(79, 79, 79, 255), stop:0.301 rgba(70, 70, 70, 255), stop:1 rgba(57, 57, 57, 255)); + color: #EEEEEE; +} +QToolBar::separator { + width: 1px; + border-right: 1px solid #6d6d6d; + background: #414141; +} +QToolButton { + border: none; + padding-left:4px; + padding-right:4px; + padding-top:5px; + padding-bottom:5px; +} +QToolButton:checked { + border: none; + padding-left:4px; + padding-right:4px; + padding-top:5px; + padding-bottom:5px; + background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(65, 65, 65, 255), stop:0.3 rgba(59, 59, 59, 255), stop:0.301 rgba(50, 50, 50, 255), stop:1 rgba(37, 37, 37, 255)); +} +QToolButton:hover { + border: none; + background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(105, 105, 105, 255), stop:0.3 rgba(99, 99, 99, 255), stop:0.301 rgba(90, 90, 90, 255), stop:1 rgba(77, 77, 77, 255)); +}