diff options
Diffstat (limited to 'src/Authoring/Studio/Palettes')
4 files changed, 7 insertions, 134 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 |