From 51e9f7bb72508ed1c8eff3e31c6cd98ba9118fe8 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Wed, 4 Apr 2012 21:30:20 +0200 Subject: [PATCH] Fix parts of Kdenlive not responding to color theme change --- src/customruler.cpp | 7 ++++- src/customruler.h | 2 ++ src/customtrackview.cpp | 1 - src/effectslistview.cpp | 5 +++ src/effectslistview.h | 3 ++ src/effectstack/collapsibleeffect.cpp | 6 ++-- src/effectstack/collapsibleeffect.h | 2 +- src/effectstack/effectstackview2.cpp | 6 +++- src/effectstack/effectstackview2.h | 3 ++ src/effectstackedit.cpp | 2 +- src/mainwindow.cpp | 45 +++++++++++++++++++++------ src/mainwindow.h | 5 +++ src/monitor.cpp | 6 ++++ src/monitor.h | 2 ++ src/projectlist.cpp | 26 +++++++++++----- src/projectlist.h | 5 ++- src/projectlistview.cpp | 22 +++++++------ src/projectlistview.h | 1 + src/smallruler.cpp | 7 +++++ src/smallruler.h | 1 + src/trackview.cpp | 24 ++++++++------ src/trackview.h | 1 + 22 files changed, 138 insertions(+), 44 deletions(-) diff --git a/src/customruler.cpp b/src/customruler.cpp index 336a8d66..029f52c2 100644 --- a/src/customruler.cpp +++ b/src/customruler.cpp @@ -88,6 +88,11 @@ CustomRuler::CustomRuler(Timecode tc, CustomTrackView *parent) : setMouseTracking(true); } +void CustomRuler::updatePalette() +{ + m_zoneColor = KStatefulBrush(KColorScheme::View, KColorScheme::PositiveBackground, KSharedConfig::openConfig(KdenliveSettings::colortheme())).brush(this).color(); +} + void CustomRuler::updateProjectFps(Timecode t) { m_timecode = t; @@ -343,7 +348,7 @@ void CustomRuler::paintEvent(QPaintEvent *e) p.setClipRect(e->rect()); // Draw background - p.fillRect(0, 0, m_duration * m_factor - m_offset, MAX_HEIGHT, palette().alternateBase().color()); + //p.fillRect(0, 0, m_duration * m_factor - m_offset, MAX_HEIGHT, palette().alternateBase().color()); // Draw zone background const int zoneStart = (int)(m_zoneStart * m_factor); diff --git a/src/customruler.h b/src/customruler.h index c36cdd3f..cc11565b 100644 --- a/src/customruler.h +++ b/src/customruler.h @@ -49,6 +49,8 @@ public: int offset() const; void updateProjectFps(Timecode t); void updateFrameSize(); + void updatePalette(); + protected: virtual void paintEvent(QPaintEvent * /*e*/); virtual void wheelEvent(QWheelEvent * e); diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp index b3ca6e39..bfa14d95 100644 --- a/src/customtrackview.cpp +++ b/src/customtrackview.cpp @@ -6519,7 +6519,6 @@ void CustomTrackView::updatePalette() pen1.setColor(palette().text().color()); m_cursorLine->setPen(pen1); } - emit tracksChanged(); } void CustomTrackView::removeTipAnimation() diff --git a/src/effectslistview.cpp b/src/effectslistview.cpp index 4d863095..ae6c8469 100644 --- a/src/effectslistview.cpp +++ b/src/effectslistview.cpp @@ -210,4 +210,9 @@ void EffectsListView::slotAutoExpand(QString text) if (!selected) m_effectsList->setCurrentItem(NULL); } +void EffectsListView::updatePalette() +{ + m_effectsList->setStyleSheet(m_effectsList->styleSheet()); +} + #include "effectslistview.moc" diff --git a/src/effectslistview.h b/src/effectslistview.h index 3fd0f89f..bba95eae 100644 --- a/src/effectslistview.h +++ b/src/effectslistview.h @@ -51,6 +51,9 @@ public: void reloadEffectList(QMenu *effectsMenu, KActionCategory *effectActions); QMenu* getEffectsMenu(); //void slotAddEffect(GenTime pos, int track, QString name); + + /** @brief Palette was changed, update styles. */ + void updatePalette(); private: EffectsListWidget *m_effectsList; diff --git a/src/effectstack/collapsibleeffect.cpp b/src/effectstack/collapsibleeffect.cpp index aa469849..5dae8b35 100644 --- a/src/effectstack/collapsibleeffect.cpp +++ b/src/effectstack/collapsibleeffect.cpp @@ -205,9 +205,9 @@ CollapsibleEffect::~CollapsibleEffect() } //static -const QString CollapsibleEffect::getStyleSheet(QPalette p) +const QString CollapsibleEffect::getStyleSheet() { - KColorScheme scheme(p.currentColorGroup(), KColorScheme::View, KSharedConfig::openConfig(KdenliveSettings::colortheme())); + KColorScheme scheme(QApplication::palette().currentColorGroup(), KColorScheme::View, KSharedConfig::openConfig(KdenliveSettings::colortheme())); QColor dark_bg = scheme.shade(KColorScheme::DarkShade); QColor selected_bg = scheme.decoration(KColorScheme::FocusColor).color(); QColor hover_bg = scheme.decoration(KColorScheme::HoverColor).color(); @@ -216,7 +216,7 @@ const QString CollapsibleEffect::getStyleSheet(QPalette p) QColor normal_bg = scheme.background(KColorScheme::AlternateBackground).color(); QColor alt_bg = scheme.background(KColorScheme::NormalBackground).color(); - KColorScheme scheme2(p.currentColorGroup(), KColorScheme::Window, KSharedConfig::openConfig(KdenliveSettings::colortheme())); + KColorScheme scheme2(QApplication::palette().currentColorGroup(), KColorScheme::Window, KSharedConfig::openConfig(KdenliveSettings::colortheme())); QColor normal_bg2 = scheme2.background(KColorScheme::NormalBackground).color(); QColor normal_bg3 = scheme2.background(KColorScheme::AlternateBackground).color(); diff --git a/src/effectstack/collapsibleeffect.h b/src/effectstack/collapsibleeffect.h index 2804cbe1..30ab1547 100644 --- a/src/effectstack/collapsibleeffect.h +++ b/src/effectstack/collapsibleeffect.h @@ -145,7 +145,7 @@ public: bool filterWheelEvent; /** @brief Return the stylesheet required for effect parameters. */ - static const QString getStyleSheet(QPalette p); + static const QString getStyleSheet(); public slots: void slotSyncEffectsPos(int pos); diff --git a/src/effectstack/effectstackview2.cpp b/src/effectstack/effectstackview2.cpp index 933630b2..dabad6e0 100644 --- a/src/effectstack/effectstackview2.cpp +++ b/src/effectstack/effectstackview2.cpp @@ -68,13 +68,17 @@ EffectStackView2::EffectStackView2(Monitor *monitor, QWidget *parent) : setEnabled(false); - setStyleSheet(CollapsibleEffect::getStyleSheet(palette())); + setStyleSheet(CollapsibleEffect::getStyleSheet()); } EffectStackView2::~EffectStackView2() { } +void EffectStackView2::updatePalette() +{ + setStyleSheet(CollapsibleEffect::getStyleSheet()); +} void EffectStackView2::slotRenderPos(int pos) { diff --git a/src/effectstack/effectstackview2.h b/src/effectstack/effectstackview2.h index 2a1cd38e..df90457e 100644 --- a/src/effectstack/effectstackview2.h +++ b/src/effectstack/effectstackview2.h @@ -66,6 +66,9 @@ public: /** @brief Delete currently selected effect. */ void deleteCurrentEffect(); + + /** @brief Palette was changed, update style. */ + void updatePalette(); protected: virtual void mouseMoveEvent(QMouseEvent * event); diff --git a/src/effectstackedit.cpp b/src/effectstackedit.cpp index 3aba9305..8ec639f4 100644 --- a/src/effectstackedit.cpp +++ b/src/effectstackedit.cpp @@ -100,7 +100,7 @@ EffectStackEdit::EffectStackEdit(Monitor *monitor, QWidget *parent) : setFrameStyle(QFrame::NoFrame); setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding)); - setStyleSheet(CollapsibleEffect::getStyleSheet(palette())); + setStyleSheet(CollapsibleEffect::getStyleSheet()); setWidget(m_baseWidget); /*m_vbox = new QVBoxLayout(m_baseWidget); m_vbox->setContentsMargins(0, 0, 0, 0); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 1df1226c..37a0c3a1 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -144,6 +144,8 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString & KXmlGuiWindow(parent), m_activeDocument(NULL), m_activeTimeline(NULL), + m_clipMonitor(NULL), + m_projectMonitor(NULL), m_recMonitor(NULL), m_renderWidget(NULL), #ifdef USE_JOGSHUTTLE @@ -630,6 +632,8 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString & KdenliveSettings::setDecklink_extension(data.section(';', 1, 1)); } } + + connect (KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), this, SLOT(slotChangePalette())); } MainWindow::~MainWindow() @@ -949,12 +953,8 @@ void MainWindow::setupActions() KToolBar *toolbar = new KToolBar("statusToolBar", this, Qt::BottomToolBarArea); toolbar->setMovable(false); - KColorScheme scheme(palette().currentColorGroup(), KColorScheme::Window, KSharedConfig::openConfig(KdenliveSettings::colortheme())); - QColor buttonBg = scheme.background(KColorScheme::LinkBackground).color(); - QColor buttonBord = scheme.foreground(KColorScheme::LinkText).color(); - QColor buttonBord2 = scheme.shade(KColorScheme::LightShade); - statusBar()->setStyleSheet(QString("QStatusBar QLabel {font-size:%1pt;} QStatusBar::item { border: 0px; font-size:%1pt;padding:0px; }").arg(statusBar()->font().pointSize())); - QString style1 = QString("QToolBar { border: 0px } QToolButton { border-style: inset; border:1px solid transparent;border-radius: 3px;margin: 0px 3px;padding: 0px;} QToolButton:hover { background: rgb(%7, %8, %9);border-style: inset; border:1px solid rgb(%7, %8, %9);border-radius: 3px;} QToolButton:checked { background-color: rgb(%1, %2, %3); border-style: inset; border:1px solid rgb(%4, %5, %6);border-radius: 3px;}").arg(buttonBg.red()).arg(buttonBg.green()).arg(buttonBg.blue()).arg(buttonBord.red()).arg(buttonBord.green()).arg(buttonBord.blue()).arg(buttonBord2.red()).arg(buttonBord2.green()).arg(buttonBord2.blue()); + + setStatusBarStyleSheet(palette()); QString styleBorderless = "QToolButton { border-width: 0px;margin: 1px 3px 0px;padding: 0px;}"; //create edit mode buttons @@ -1040,7 +1040,6 @@ void MainWindow::setupActions() actionWidget->setMaximumWidth(max); actionWidget->setMaximumHeight(max - 4); - toolbar->setStyleSheet(style1); connect(toolGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotChangeTool(QAction *))); toolbar->addSeparator(); @@ -1683,6 +1682,17 @@ void MainWindow::slotDisplayActionMessage(QAction *a) statusBar()->showMessage(a->data().toString(), 3000); } +void MainWindow::setStatusBarStyleSheet(const QPalette &p) +{ + KColorScheme scheme(p.currentColorGroup(), KColorScheme::Window, KSharedConfig::openConfig(KdenliveSettings::colortheme())); + QColor buttonBg = scheme.background(KColorScheme::LinkBackground).color(); + QColor buttonBord = scheme.foreground(KColorScheme::LinkText).color(); + QColor buttonBord2 = scheme.shade(KColorScheme::LightShade); + statusBar()->setStyleSheet(QString("QStatusBar QLabel {font-size:%1pt;} QStatusBar::item { border: 0px; font-size:%1pt;padding:0px; }").arg(statusBar()->font().pointSize())); + QString style1 = QString("QToolBar { border: 0px } QToolButton { border-style: inset; border:1px solid transparent;border-radius: 3px;margin: 0px 3px;padding: 0px;} QToolButton:hover { background: %3;border-style: inset; border:1px solid %3;border-radius: 3px;} QToolButton:checked { background-color: %1; border-style: inset; border:1px solid %2;border-radius: 3px;}").arg(buttonBg.name()).arg(buttonBord.name()).arg(buttonBord2.name()); + statusBar()->setStyleSheet(style1); +} + void MainWindow::loadLayouts() { QMenu *saveLayout = (QMenu*)(factory()->container("layout_save_as", this)); @@ -4176,6 +4186,7 @@ void MainWindow::slotChangePalette(QAction *action, const QString &themename) } kapp->setPalette(plt); + slotChangePalette(); const QObjectList children = statusBar()->children(); foreach(QObject * child, children) { @@ -4187,9 +4198,6 @@ void MainWindow::slotChangePalette(QAction *action, const QString &themename) ((QWidget*)subchild)->setPalette(plt); } } - if (m_activeTimeline) { - m_activeTimeline->projectView()->updatePalette(); - } } @@ -4418,6 +4426,23 @@ void MainWindow::slotDownloadResources() d->show(); } +void MainWindow::slotChangePalette() +{ + QPalette plt = QApplication::palette(); + if (m_effectStack) m_effectStack->updatePalette(); + if (m_projectList) m_projectList->updatePalette(); + if (m_effectList) m_effectList->updatePalette(); + + if (m_clipMonitor) m_clipMonitor->setPalette(plt); + if (m_projectMonitor) m_projectMonitor->setPalette(plt); + + setStatusBarStyleSheet(plt); + if (m_activeTimeline) { + m_activeTimeline->updatePalette(); + } +} + + #include "mainwindow.moc" #ifdef DEBUG_MAINW diff --git a/src/mainwindow.h b/src/mainwindow.h index 21e3b039..4b585136 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -311,6 +311,9 @@ private: StopmotionWidget *m_stopmotion; QTime m_timer; + + /** @brief Update statusbar stylesheet (in case of color theme change). */ + void setStatusBarStyleSheet(const QPalette &p); public slots: /** @brief Prepares opening @param url. @@ -548,6 +551,8 @@ private slots: void slotElapsedTime(); /** @brief Open the online services search dialog. */ void slotDownloadResources(); + + void slotChangePalette(); signals: Q_SCRIPTABLE void abortRenderJob(const QString &url); diff --git a/src/monitor.cpp b/src/monitor.cpp index 3a69d0f7..4384a4d2 100644 --- a/src/monitor.cpp +++ b/src/monitor.cpp @@ -1051,6 +1051,12 @@ void Monitor::reloadProducer(const QString &id) slotSetClipProducer(m_currentClip, m_currentClip->zone(), true); } +void Monitor::setPalette ( const QPalette & p) +{ + QWidget::setPalette(p); + if (m_ruler) m_ruler->updatePalette(); + +} Overlay::Overlay(QWidget* parent) : QLabel(parent) diff --git a/src/monitor.h b/src/monitor.h index 0fe6d50a..2bdf65f4 100644 --- a/src/monitor.h +++ b/src/monitor.h @@ -89,6 +89,8 @@ public: QWidget *container(); void reloadProducer(const QString &id); QFrame *m_volumePopup; + /** @brief Reimplemented from QWidget, updates the palette colors. */ + void setPalette ( const QPalette & p); protected: virtual void mousePressEvent(QMouseEvent * event); diff --git a/src/projectlist.cpp b/src/projectlist.cpp index 3ebba4c6..276a39ad 100644 --- a/src/projectlist.cpp +++ b/src/projectlist.cpp @@ -72,6 +72,7 @@ #include #include #include +#include #include #include #include @@ -84,7 +85,15 @@ SmallInfoLabel::SmallInfoLabel(QWidget *parent) : QPushButton(parent) /*QString style = "QToolButton {background-color: %1;border-style: outset;border-width: 2px; border-radius: 5px;border-color: beige;}";*/ - KColorScheme scheme(palette().currentColorGroup(), KColorScheme::Window, KSharedConfig::openConfig(KdenliveSettings::colortheme())); + m_timeLine = new QTimeLine(500, this); + QObject::connect(m_timeLine, SIGNAL(valueChanged(qreal)), this, SLOT(slotTimeLineChanged(qreal))); + QObject::connect(m_timeLine, SIGNAL(finished()), this, SLOT(slotTimeLineFinished())); + hide(); +} + +const QString SmallInfoLabel::getStyleSheet(const QPalette &p) +{ + KColorScheme scheme(p.currentColorGroup(), KColorScheme::Window, KSharedConfig::openConfig(KdenliveSettings::colortheme())); QColor bg = scheme.background(KColorScheme::LinkBackground).color(); QColor fg = scheme.foreground(KColorScheme::LinkText).color(); QString style = QString("QPushButton {padding:2px;background-color: rgb(%1, %2, %3);border-radius: 4px;border: none;color: rgb(%4, %5, %6)}").arg(bg.red()).arg(bg.green()).arg(bg.blue()).arg(fg.red()).arg(fg.green()).arg(fg.blue()); @@ -93,11 +102,7 @@ SmallInfoLabel::SmallInfoLabel(QWidget *parent) : QPushButton(parent) fg = scheme.foreground(KColorScheme::ActiveText).color(); style.append(QString("\nQPushButton:hover {padding:2px;background-color: rgb(%1, %2, %3);border-radius: 4px;border: none;color: rgb(%4, %5, %6)}").arg(bg.red()).arg(bg.green()).arg(bg.blue()).arg(fg.red()).arg(fg.green()).arg(fg.blue())); - setStyleSheet(style); - m_timeLine = new QTimeLine(500, this); - QObject::connect(m_timeLine, SIGNAL(valueChanged(qreal)), this, SLOT(slotTimeLineChanged(qreal))); - QObject::connect(m_timeLine, SIGNAL(finished()), this, SLOT(slotTimeLineFinished())); - hide(); + return style; } void SmallInfoLabel::slotTimeLineChanged(qreal value) @@ -233,6 +238,7 @@ ProjectList::ProjectList(QWidget *parent) : // small info button for pending jobs m_infoLabel = new SmallInfoLabel(this); + m_infoLabel->setStyleSheet(SmallInfoLabel::getStyleSheet(palette())); connect(this, SIGNAL(jobCount(int)), m_infoLabel, SLOT(slotSetJobCount(int))); m_jobsMenu = new QMenu(this); connect(m_jobsMenu, SIGNAL(aboutToShow()), this, SLOT(slotPrepareJobsMenu())); @@ -269,7 +275,7 @@ ProjectList::ProjectList(QWidget *parent) : frame->setLayout(box); layout->addWidget(frame); - m_listView = new ProjectListView; + m_listView = new ProjectListView(this); layout->addWidget(m_listView); #if KDE_IS_VERSION(4,7,0) @@ -3448,4 +3454,10 @@ void ProjectList::slotDiscardClipJobs() discardJobs(id); } +void ProjectList::updatePalette() +{ + m_infoLabel->setStyleSheet(SmallInfoLabel::getStyleSheet(QApplication::palette())); + m_listView->updateStyleSheet(); +} + #include "projectlist.moc" diff --git a/src/projectlist.h b/src/projectlist.h index bd04931d..25f7ae57 100644 --- a/src/projectlist.h +++ b/src/projectlist.h @@ -80,7 +80,7 @@ class SmallInfoLabel: public QPushButton Q_OBJECT public: SmallInfoLabel(QWidget *parent = 0); - + static const QString getStyleSheet(const QPalette &p); private: QTimeLine* m_timeLine; @@ -261,6 +261,9 @@ public: void startClipFilterJob(const QString &filterName, const QString &condition); /** @brief Set current document for the project tree. */ void setDocument(KdenliveDoc *doc); + + /** @brief Palette was changed, update style. */ + void updatePalette(); public slots: void updateAllClips(bool displayRatioChanged, bool fpsChanged, QStringList brokenClips); diff --git a/src/projectlistview.cpp b/src/projectlistview.cpp index aee90db9..f5b8a888 100644 --- a/src/projectlistview.cpp +++ b/src/projectlistview.cpp @@ -45,15 +45,7 @@ ProjectListView::ProjectListView(QWidget *parent) : setFrameShape(QFrame::NoFrame); setRootIsDecorated(true); - QString style = "QTreeView::branch:has-siblings:!adjoins-item{border-image: none;border:0px} \ - QTreeView::branch:has-siblings:adjoins-item {border-image: none;border:0px} \ - QTreeView::branch:!has-children:!has-siblings:adjoins-item {border-image: none;border:0px} \ - QTreeView::branch:has-children:!has-siblings:closed,QTreeView::branch:closed:has-children:has-siblings { \ - border-image: none;image: url(:/images/stylesheet-branch-closed.png);} \ - QTreeView::branch:open:has-children:!has-siblings,QTreeView::branch:open:has-children:has-siblings { \ - border-image: none;image: url(:/images/stylesheet-branch-open.png);}"; - - setStyleSheet(style); + updateStyleSheet(); setColumnCount(4); QStringList headers; @@ -82,6 +74,18 @@ ProjectListView::~ProjectListView() { } +void ProjectListView::updateStyleSheet() +{ + QString style = "QTreeView::branch:has-siblings:!adjoins-item{border-image: none;border:0px} \ + QTreeView::branch:has-siblings:adjoins-item {border-image: none;border:0px} \ + QTreeView::branch:!has-children:!has-siblings:adjoins-item {border-image: none;border:0px} \ + QTreeView::branch:has-children:!has-siblings:closed,QTreeView::branch:closed:has-children:has-siblings { \ + border-image: none;image: url(:/images/stylesheet-branch-closed.png);} \ + QTreeView::branch:open:has-children:!has-siblings,QTreeView::branch:open:has-children:has-siblings { \ + border-image: none;image: url(:/images/stylesheet-branch-open.png);}"; + setStyleSheet(style); +} + void ProjectListView::processLayout() { executeDelayedItemsLayout(); diff --git a/src/projectlistview.h b/src/projectlistview.h index 62a632e6..26e2c581 100644 --- a/src/projectlistview.h +++ b/src/projectlistview.h @@ -37,6 +37,7 @@ public: ProjectListView(QWidget *parent = 0); virtual ~ProjectListView(); void processLayout(); + void updateStyleSheet(); protected: virtual void contextMenuEvent(QContextMenuEvent * event); diff --git a/src/smallruler.cpp b/src/smallruler.cpp index dce24f46..89d876d8 100644 --- a/src/smallruler.cpp +++ b/src/smallruler.cpp @@ -233,4 +233,11 @@ void SmallRuler::paintEvent(QPaintEvent *e) p.drawPolygon(pa); } +void SmallRuler::updatePalette() +{ + KSharedConfigPtr config = KSharedConfig::openConfig(KdenliveSettings::colortheme()); + m_zoneBrush = KStatefulBrush(KColorScheme::View, KColorScheme::PositiveBackground, config); + updatePixmap(); +} + #include "smallruler.moc" diff --git a/src/smallruler.h b/src/smallruler.h index 9d717588..224ba63a 100644 --- a/src/smallruler.h +++ b/src/smallruler.h @@ -41,6 +41,7 @@ public: QPoint zone(); void setMarkers(QList < int > list); int position() const; + void updatePalette(); protected: virtual void paintEvent(QPaintEvent *e); diff --git a/src/trackview.cpp b/src/trackview.cpp index c3cc0d11..5e589231 100644 --- a/src/trackview.cpp +++ b/src/trackview.cpp @@ -537,14 +537,7 @@ void TrackView::slotRebuildTrackHeaders() HeaderTrack *header = NULL; QFrame *frame = NULL; - QPalette p = palette(); - KColorScheme scheme(p.currentColorGroup(), KColorScheme::View, KSharedConfig::openConfig(KdenliveSettings::colortheme())); - QColor norm = scheme.shade(scheme.background(KColorScheme::ActiveBackground).color(), KColorScheme::MidShade); - p.setColor(QPalette::Button, norm); - - QColor col = scheme.background().color(); - QColor col2 = scheme.foreground().color(); - headers_container->setStyleSheet(QString("QLineEdit { background-color: transparent;color: rgb(%4, %5, %6);} QLineEdit:hover{ background-color: rgb(%1, %2, %3);} QLineEdit:focus { background-color: rgb(%1, %2, %3);}").arg(col.red()).arg(col.green()).arg(col.blue()).arg(col2.red()).arg(col2.green()).arg(col2.blue())); + updatePalette(); for (int i = 0; i < max; i++) { frame = new QFrame(headers_container); @@ -553,7 +546,6 @@ void TrackView::slotRebuildTrackHeaders() headers_container->layout()->addWidget(frame); TrackInfo info = list.at(max - i - 1); header = new HeaderTrack(i, info, height, m_trackActions, headers_container); - header->setPalette(p); header->setSelectedIndex(m_trackview->selectedTrack()); connect(header, SIGNAL(switchTrackVideo(int)), m_trackview, SLOT(slotSwitchTrackVideo(int))); connect(header, SIGNAL(switchTrackAudio(int)), m_trackview, SLOT(slotSwitchTrackAudio(int))); @@ -572,6 +564,20 @@ void TrackView::slotRebuildTrackHeaders() } +void TrackView::updatePalette() +{ + QPalette p = palette(); + KColorScheme scheme(p.currentColorGroup(), KColorScheme::View, KSharedConfig::openConfig(KdenliveSettings::colortheme())); + QColor norm = scheme.shade(scheme.background(KColorScheme::ActiveBackground).color(), KColorScheme::MidShade); + p.setColor(QPalette::Button, norm); + QColor col = scheme.background().color(); + QColor col2 = scheme.foreground().color(); + headers_container->setStyleSheet(QString("QLineEdit { background-color: transparent;color: %1;} QLineEdit:hover{ background-color: %2;} QLineEdit:focus { background-color: %2;}").arg(col2.name()).arg(col.name())); + m_trackview->updatePalette(); + m_ruler->updatePalette(); + +} + void TrackView::adjustTrackHeaders() { int height = KdenliveSettings::trackheight() * m_scene->scale().y() - 1; diff --git a/src/trackview.h b/src/trackview.h index 5b19ecdb..8d3ff11d 100644 --- a/src/trackview.h +++ b/src/trackview.h @@ -78,6 +78,7 @@ public: void checkTrackHeight(); void updateProfile(); + void updatePalette(); protected: virtual void keyPressEvent(QKeyEvent * event); -- 2.39.2