diff options
author | Tomi Korpipaa <tomi.korpipaa@qt.io> | 2018-09-12 09:56:14 +0300 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@qt.io> | 2018-09-12 08:36:26 +0000 |
commit | 444722f1c4838c847cdd107b03a95650a7ccb487 (patch) | |
tree | 37788b6bcf7b4d92a7dd8fcff6b88636b7bc490a | |
parent | 931a4fa7e66150ae23330403917e737068651085 (diff) |
Fix style issue with timeline time label
Also removed obsolete styles from style.qss, as it was being
edited anyway.
Task-number: QT3DS-1928
Change-Id: Iec7bf2bc47202cada7de2cf613b1c740586b9dd2
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
6 files changed, 14 insertions, 172 deletions
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbar.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbar.cpp index b9bfdbc0..d7cbc10a 100644 --- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbar.cpp +++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbar.cpp @@ -43,6 +43,7 @@ #include <QtWidgets/qslider.h> #include <QtCore/qdatetime.h> #include <QtCore/qtimer.h> +#include <QtWidgets/qpushbutton.h> TimelineToolbar::TimelineToolbar() : QToolBar() { @@ -75,11 +76,10 @@ TimelineToolbar::TimelineToolbar() : QToolBar() m_actionDataInput = new QAction(m_iconDiInactive, tr("No Controller"), this); m_actionDeleteRow = new QAction(iconDelete, tr("Delete Selected Object (Del)"), this); m_actionPlayStop = new QAction(this); - m_timeLabel = new TimelineToolbarLabel(this); + m_timeLabel = new QPushButton({}, this); m_diLabel = new QLabel(); m_actionZoomIn = new QAction(iconZoomIn, tr("Zoom In"), this); m_actionZoomOut = new QAction(iconZoomOut, tr("Zoom Out"), this); - QAction *actionGoToTime = new QAction(this); m_scaleSlider = new QSlider(); m_scaleSlider->setOrientation(Qt::Horizontal); @@ -88,7 +88,8 @@ TimelineToolbar::TimelineToolbar() : QToolBar() m_scaleSlider->setMaximum(22); m_scaleSlider->setValue(2); - m_timeLabel->setText(tr("0:00.000")); + m_timeLabel->setObjectName(QLatin1String("timelineButton")); + m_timeLabel->setFlat(true); m_timeLabel->setMinimumWidth(80); m_timeLabel->setToolTip(tr("Go To Time (%1%2T)").arg(ctrlKey).arg(altKey)); @@ -104,7 +105,7 @@ TimelineToolbar::TimelineToolbar() : QToolBar() // connections connect(m_actionNewLayer, &QAction::triggered, this, &TimelineToolbar::newLayerTriggered); connect(m_actionDeleteRow, &QAction::triggered, this, &TimelineToolbar::deleteLayerTriggered); - connect(m_timeLabel, &TimelineToolbarLabel::clicked, this, &TimelineToolbar::gotoTimeTriggered); + connect(m_timeLabel, &QPushButton::clicked, this, &TimelineToolbar::gotoTimeTriggered); connect(actionFirst, &QAction::triggered, this, &TimelineToolbar::firstFrameTriggered); connect(m_actionPlayStop, &QAction::triggered, this, &TimelineToolbar::onPlayButtonClicked); connect(actionLast, &QAction::triggered, this, &TimelineToolbar::lastFrameTriggered); @@ -112,7 +113,6 @@ TimelineToolbar::TimelineToolbar() : QToolBar() connect(m_actionZoomIn, &QAction::triggered, this, &TimelineToolbar::onZoomInButtonClicked); connect(m_actionZoomOut, &QAction::triggered, this, &TimelineToolbar::onZoomOutButtonClicked); connect(m_actionDataInput, &QAction::triggered, this, &TimelineToolbar::onDiButtonClicked); - connect(actionGoToTime, &QAction::triggered, this, &TimelineToolbar::gotoTimeTriggered); // add actions addAction(m_actionNewLayer); @@ -131,16 +131,12 @@ TimelineToolbar::TimelineToolbar() : QToolBar() addWidget(m_scaleSlider); addAction(m_actionZoomIn); - // child-action, not visible in UI - m_timeLabel->addAction(actionGoToTime); - // add keyboard shortcuts m_actionZoomOut->setShortcut(Qt::Key_Minus); m_actionZoomOut->setShortcutContext(Qt::ApplicationShortcut); m_actionZoomIn->setShortcut(Qt::Key_Plus); m_actionZoomIn->setShortcutContext(Qt::ApplicationShortcut); - actionGoToTime->setShortcut(QKeySequence(Qt::ControlModifier | Qt::AltModifier | Qt::Key_T)); - actionGoToTime->setShortcutContext(Qt::ApplicationShortcut); + m_timeLabel->setShortcut(QKeySequence(Qt::ControlModifier | Qt::AltModifier | Qt::Key_T)); m_actionNewLayer->setShortcut(QKeySequence(Qt::ControlModifier | Qt::Key_L)); m_actionNewLayer->setShortcutContext(Qt::ApplicationShortcut); diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbar.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbar.h index 3e65e45d..9921c495 100644 --- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbar.h +++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbar.h @@ -30,7 +30,6 @@ #define TIMELINETOOLBAR_H #include "SelectedValueImpl.h" -#include "TimelineToolbarLabel.h" #include "Qt3DSDMSignals.h" #include "DispatchListeners.h" #include "Dispatch.h" @@ -90,7 +89,7 @@ private: void updateDataInputStatus(); void updateTimelineTitleColor(bool controlled); - TimelineToolbarLabel *m_timeLabel; + QPushButton *m_timeLabel; QLabel *m_diLabel; QAction *m_actionDeleteRow; QAction *m_actionPlayStop; diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbarLabel.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbarLabel.cpp deleted file mode 100644 index 69c8843d..00000000 --- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbarLabel.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "TimelineToolbarLabel.h" -#include "StudioPreferences.h" -#include "StudioApp.h" - -TimelineToolbarLabel::TimelineToolbarLabel(QWidget *parent) - : QLabel(parent) -{ - setHighlight(false); - setAlignment(Qt::AlignCenter); -} - -void TimelineToolbarLabel::enterEvent(QEvent *event) -{ - Q_UNUSED(event); - if (isEnabled()) - setHighlight(true); -} - -void TimelineToolbarLabel::leaveEvent(QEvent *event) -{ - Q_UNUSED(event); - if (isEnabled()) - setHighlight(false); -} - -void TimelineToolbarLabel::mousePressEvent(QMouseEvent *event) -{ - g_StudioApp.setLastActiveView(parentWidget()->parentWidget()); - emit clicked(event); -} - -void TimelineToolbarLabel::setHighlight(bool highlight) -{ - if (highlight) { - QColor bgColor = CStudioPreferences::GetMouseOverHighlightColor(); - QString bgColorStyle = QStringLiteral("background-color: ") + bgColor.name(); - setStyleSheet(bgColorStyle); - } else { - setStyleSheet("background-color: transparent;"); - } -} diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbarLabel.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbarLabel.h deleted file mode 100644 index 412797e7..00000000 --- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/TimelineToolbarLabel.h +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef TIMELINETOOLBARLABEL_H -#define TIMELINETOOLBARLABEL_H - -#include <QtWidgets/qlabel.h> -#include <QtGui/qevent.h> - -class TimelineToolbarLabel : public QLabel -{ - Q_OBJECT -public: - explicit TimelineToolbarLabel(QWidget *parent = nullptr); - -protected: - void enterEvent(QEvent *event) override; - void leaveEvent(QEvent *event) override; - void mousePressEvent(QMouseEvent *event) override; - -signals: - void clicked(QMouseEvent *event); - -private: - void setHighlight(bool highlight); -}; - -#endif // TIMELINETOOLBARLABEL_H diff --git a/src/Authoring/Studio/Qt3DStudio.pro b/src/Authoring/Studio/Qt3DStudio.pro index e04d05b1..2a1cd865 100644 --- a/src/Authoring/Studio/Qt3DStudio.pro +++ b/src/Authoring/Studio/Qt3DStudio.pro @@ -191,7 +191,6 @@ HEADERS += \ Palettes/TimelineGraphicsView/ui/Ruler.h \ Palettes/TimelineGraphicsView/ui/TimelineItem.h \ Palettes/TimelineGraphicsView/ui/TimelineToolbar.h \ - Palettes/TimelineGraphicsView/ui/TimelineToolbarLabel.h \ Palettes/TimelineGraphicsView/ui/TreeHeader.h \ Palettes/TimelineGraphicsView/ui/TreeHeaderView.h \ PreviewHelper.h \ @@ -348,7 +347,6 @@ SOURCES += \ Palettes/TimelineGraphicsView/ui/Ruler.cpp \ Palettes/TimelineGraphicsView/ui/TimelineItem.cpp \ Palettes/TimelineGraphicsView/ui/TimelineToolbar.cpp \ - Palettes/TimelineGraphicsView/ui/TimelineToolbarLabel.cpp \ Palettes/TimelineGraphicsView/ui/TreeHeader.cpp \ Palettes/TimelineGraphicsView/ui/TreeHeaderView.cpp \ PreviewHelper.cpp \ diff --git a/src/Authoring/Studio/style.qss b/src/Authoring/Studio/style.qss index a5b4bab9..b464bbc0 100644 --- a/src/Authoring/Studio/style.qss +++ b/src/Authoring/Studio/style.qss @@ -310,27 +310,17 @@ QDialog#AboutDlg QPushButton:pressed { border: 1px solid #41cd52; } -/* TimeLineToolbar */ -QWidget#TimeLineParent, -TimeLineToolbar QWidget#layoutWidget { - background: #404244; -} - -TimeLineToolbar QPushButton#timeButton { +/* TimelineToolbar */ +QPushButton#timelineButton { border: 0px; } -TimeLineToolbar QLabel#dataInputName { - background: transparent; - color: #ff5102; +QPushButton:pressed#timelineButton { + background: #46a2da; } -QLabel#timebarToolTip { - background: #404244; - color: #ffffff; - font-size: 12px; - border: 1px solid #727476; - border-radius: 2; +QPushButton:hover:!pressed#timelineButton { + background: #262829; } /* Loading progress dialog */ @@ -346,15 +336,12 @@ QDialog#ProgressDlg QWidget#progressActionText { font-size: 16px; } -/* Sub-presentation Dialogs and Data Input Dialogs */ -QDialog#SubPresentationListDlg QTableView QTableCornerButton::section, -QDialog#SubPresentationListDlg QHeaderView::section, +/* Data Input Dialogs */ QDialog#DataInputListDlg QTableView QTableCornerButton::section, QDialog#DataInputListDlg QHeaderView::section { font-weight: bold; } -QDialog#SubPresentationListDlg QTableView, QDialog#DataInputListDlg QTableView { selection-background-color: #46a2da; gridline-color: #2e2f30; @@ -370,7 +357,6 @@ QDialog#DataInputListDlg QComboBox QAbstractItemView::item margin-top: 5px; } -QDialog#SubPresentationListDlg QPushButton#SubPresentationListButton, QDialog#DataInputListDlg QPushButton#DataInputListButton { background-color: transparent; border: 0px; @@ -381,31 +367,16 @@ QDialog#DataInputListDlg QPushButton#DataInputListButton { padding: 0px; } -QDialog#SubPresentationListDlg QPushButton#SubPresentationListButton:pressed, QDialog#DataInputListDlg QPushButton#DataInputListButton:pressed { background-color: #262829; } -QDialog#SubPresentationDlg QPushButton:!enabled, QDialog#DataInputDlg QPushButton:!enabled, QDialog#DataInputDlg QComboBox QAbstractItemView::item:disabled { background: transparent; color: #727476; } -/* Data input chooser */ -DataInputSelectDlg { - border: 1px solid #404244; -} - -DataInputSelectDlg::item:selected { - background: #46a2da; -} - -DataInputSelectDlg::item:hover { - background: #23516d; -} - /* QSlider horizontal */ QSlider { background: transparent; |