Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt5 style fixes #915

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Gui/AboutWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ AboutWindow::AboutWindow(QWidget* parent)
///filling tabs now

_aboutText = new QTextBrowser(_tabWidget);
_aboutText->setObjectName( QString::fromUtf8("TextBrowser") );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the objectname in Qt5? Doesn't it make more sense to use that objectname in the stylesheet as an alternative, rather than cluttering (a tiny bit) the code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason QTextBrowser defaults to black text in some widgets, but not all. So adding a objectname makes it easy to style the widgets that needs fixes.

Can of course figure out a better solution, just launched Natron and noticed the issue. Will close and submit a new PR when changed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you maybe print some properties of _aboutText to see why it didn't catch the right stylesheet entry? I know @acolwell cares a lot about code clutter ;-)
If that's the only way to go, then let's do it, but in this case I would ask for @acolwell's review as well

Copy link
Contributor Author

@rodlie rodlie Sep 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree to avoid code clutter, will find a qss-only fix.

_aboutText->setOpenExternalLinks(true);
QString aboutText;
{
Expand Down Expand Up @@ -450,6 +451,7 @@ AboutWindow::AboutWindow(QWidget* parent)
_tabWidget->addTab( _aboutText, tr("About") );

_changelogText = new QTextBrowser(_tabWidget);
_changelogText->setObjectName( QString::fromUtf8("TextBrowser") );
_changelogText->setOpenExternalLinks(true);
{
QFile changelogFile( QString::fromUtf8(":CHANGELOG.md") );
Expand All @@ -459,12 +461,14 @@ AboutWindow::AboutWindow(QWidget* parent)
_tabWidget->addTab( _changelogText, tr("Changelog") );

_libsText = new QTextBrowser(_tabWidget);
_libsText->setObjectName( QString::fromUtf8("TextBrowser") );
_libsText->setOpenExternalLinks(true);
updateLibrariesVersions();

_tabWidget->addTab( _libsText, tr("Libraries") );

_teamText = new QTextBrowser(_tabWidget);
_teamText->setObjectName( QString::fromUtf8("TextBrowser") );
_teamText->setOpenExternalLinks(false);
{
QFile team_file( QString::fromUtf8(":CONTRIBUTORS.txt") );
Expand All @@ -474,6 +478,7 @@ AboutWindow::AboutWindow(QWidget* parent)
_tabWidget->addTab( _teamText, tr("Contributors") );

_licenseText = new QTextBrowser(_tabWidget);
_licenseText->setObjectName( QString::fromUtf8("TextBrowser") );
_licenseText->setOpenExternalLinks(false);
{
QFile license( QString::fromUtf8(":LICENSE.txt") );
Expand Down Expand Up @@ -507,6 +512,7 @@ AboutWindow::AboutWindow(QWidget* parent)
splitter->addWidget(_view);

_thirdPartyBrowser = new QTextBrowser(thirdPartyContainer);
_thirdPartyBrowser->setObjectName( QString::fromUtf8("TextBrowser") );
_thirdPartyBrowser->setOpenExternalLinks(false);
splitter->addWidget(_thirdPartyBrowser);
splitter->setStretchFactor(0, 1);
Expand Down
114 changes: 64 additions & 50 deletions Gui/Resources/Stylesheets/mainstyle.qss
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,18 @@ QLabel {
color: %5;
}

Label[altered="true"],
Natron--Label[altered="true"] { color: %10; }
Label[altered="false"],
Natron--Label[altered="false"] { color: %5; }





Label[altered="true"] { color: %10; }
Label[altered="false"] { color: %5; }



NodeSettingsPanel[_selected="true"] {
NodeSettingsPanel[_selected="true"],
Natron--NodeSettingsPanel[_selected="true"] {
border:1px solid white;
border-radius: 2px;
}
NodeSettingsPanel[_selected="false"] {
NodeSettingsPanel[_selected="false"],
Natron--NodeSettingsPanel[_selected="false"] {
border:1px solid black;
border-radius: 2px;
}
Expand Down Expand Up @@ -155,7 +152,6 @@ QScrollBar::sub-line:horizontal {
subcontrol-origin: margin;
}


QTreeView,QListView,QHeaderView {
color: %5;
background-color: %3;
Expand Down Expand Up @@ -196,80 +192,93 @@ QHeaderView:section {
selection-background-color: %1; /* same as selection-color??? */
}

ComboBox {
ComboBox,
Natron--ComboBox {
border-radius: 2px;
border: 1px solid black;
}

/*See http://doc.qt.io/qt-5/stylesheet-syntax.html for classes in namespaces*/

/*Basic background: No multiple selection, no animation, no sunken style*/
ClickableLabel[dirty="false"][animation="0"][sunkenStyle="false"]{
ClickableLabel[dirty="false"][animation="0"][sunkenStyle="false"],
Natron--ClickableLabel[dirty="false"][animation="0"][sunkenStyle="false"] {
background-color: %2;
}

/*Basic background: No multiple selection, no animation but sunken style*/
ClickableLabel[dirty="false"][animation="0"][sunkenStyle="true"]{
ClickableLabel[dirty="false"][animation="0"][sunkenStyle="true"],
Natron--ClickableLabel[dirty="false"][animation="0"][sunkenStyle="true"] {
background-color: %3;
}

/*Multiple selection always have a black background*/
ClickableLabel[dirty="true"]{
ClickableLabel[dirty="true"],
Natron--ClickableLabel[dirty="true"] {
background-color: black;
}

/*No multiple selection and interpolated*/
ClickableLabel[dirty="false"][animation="1"]{
ClickableLabel[dirty="false"][animation="1"],
Natron--ClickableLabel[dirty="false"][animation="1"] {
background-color: %6;
}

/*Multiple selection and interpolated: change text color instead*/
ClickableLabel[dirty="true"][animation="1"] {
ClickableLabel[dirty="true"][animation="1"],
Natron--ClickableLabel[dirty="true"][animation="1"] {
color: %6;
}

/*No multiple selection and keyframe*/
ClickableLabel[dirty="false"][animation="2"]{
ClickableLabel[dirty="false"][animation="2"],
Natron--ClickableLabel[dirty="false"][animation="2"] {
background-color: %7;
}

/*Multiple selection and keyframe: change text color instead*/
ClickableLabel[dirty="true"][animation="2"] {
ClickableLabel[dirty="true"][animation="2"],
Natron--ClickableLabel[dirty="true"][animation="2"] {
color: %7;
}

/*No multiple selection and expr. Change also text colour otherwise the default white is not perceptible*/
ClickableLabel[dirty="false"][animation="3"] {
ClickableLabel[dirty="false"][animation="3"],
Natron--ClickableLabel[dirty="false"][animation="3"] {
background-color: %7;
color: %9;
}

/*Multiple selection and expr: change text color instead*/
ClickableLabel[dirty="true"][animation="3"] {
ClickableLabel[dirty="true"][animation="3"],
Natron--ClickableLabel[dirty="true"][animation="3"] {
color: %9;
}

/*Disabled and no multiple selection: */
ClickableLabel[readOnly="true"][dirty="false"] {
ClickableLabel[readOnly="true"][dirty="false"],
Natron--ClickableLabel[readOnly="true"][dirty="false"] {
color: %8;
}

/*Disabled and multiple selection: */
ClickableLabel[readOnly="true"][dirty="true"] {
ClickableLabel[readOnly="true"][dirty="true"],
Natron--ClickableLabel[readOnly="true"][dirty="true"] {
background-color: black;
color: %8;
}



TabWidget{
TabWidget,
Natron--TabWidget {
background-color: %4;
}

NodeSettingsPanel{
NodeSettingsPanel,
Natron--NodeSettingsPanel {
background-color: %2;
color: %5;
}

QPushButton{
background-color: %3;
color: %5;
Expand Down Expand Up @@ -304,8 +313,8 @@ QDialog {
background-color: %2;
}


NodeCreationDialog {
NodeCreationDialog,
Natron--NodeCreationDialog {
background-color: %2;
border: 5px black;
border-radius:2px;
Expand All @@ -319,30 +328,31 @@ QToolButton:pressed {
border: 1px solid %1;
}


QToolButton:focus {
border: 1px solid %1;
}

ViewerToolButton[isSelected="true"]
{
ViewerToolButton[isSelected="true"],
Natron--ViewerToolButton[isSelected="true"] {
border: 1px solid %1;
}

ViewerToolButton
{
ViewerToolButton,
Natron--ViewerToolButton {
border: 0px ;
}

ViewerToolButton[isSelected="false"]:pressed {
ViewerToolButton[isSelected="false"]:pressed,
Natron--ViewerToolButton[isSelected="false"]:pressed {
border: 0px;
}
ViewerToolButton[isSelected="true"]:pressed {
ViewerToolButton[isSelected="true"]:pressed,
Natron--ViewerToolButton[isSelected="true"]:pressed {
border: 1px solid %1;
}


ViewerToolButton:focus {
ViewerToolButton:focus,
Natron--ViewerToolButton:focus {
border: 0px;
}

Expand Down Expand Up @@ -384,7 +394,6 @@ QScrollArea {
background-color: %2;
}


QComboBox {
color: %5;
background-color: %3;
Expand Down Expand Up @@ -416,7 +425,6 @@ QTabWidget::pane {
margin-top: -1px;
}


QLineEdit {
border: 1px solid;
border-radius: 1px;
Expand Down Expand Up @@ -475,7 +483,8 @@ QTabBar::tab {
border-top-left-radius: 5px;
}

QTabBar::tab#DockablePanelTabWidget {
QTabBar::tab#DockablePanelTabWidget,
QTabBar::tab#Natron--DockablePanelTabWidget {
min-width: 3em;
}

Expand All @@ -488,7 +497,6 @@ QTabBar::tab:selected {
/*border-color: %1;*/
}


QTabBar::tab:!selected {
color: %5; /* color of the text on deselected tabs */
}
Expand Down Expand Up @@ -518,15 +526,18 @@ QTabBar::close-button:hover {
subcontrol-position: right;
}

TabBar[mouseOverFocus="true"][clickFocus="false"] {
TabBar[mouseOverFocus="true"][clickFocus="false"],
Natron--TabBar[mouseOverFocus="true"][clickFocus="false"] {
color: %11;
}

TabBar[clickFocus="true"] {
TabBar[clickFocus="true"],
Natron--TabBar[clickFocus="true"] {
color: %1;
}

TabBar[mouseOverFocus="false"][clickFocus="false"] {
TabBar[mouseOverFocus="false"][clickFocus="false"],
Natron--TabBar[mouseOverFocus="false"][clickFocus="false"] {
color: %5;
}

Expand Down Expand Up @@ -583,8 +594,6 @@ Natron--SpinBox[altered="true"][dirty="false"] {
color: %10;
}



LineEdit[animation="0"],
Natron--LineEdit[animation="0"] {
background-color: %3;
Expand All @@ -611,7 +620,7 @@ Natron--LineEdit[altered="true"] {
color: %10;
}

QTextEdit{
QTextEdit {
color: %5;
background-color: %3;
selection-color: %8;
Expand Down Expand Up @@ -748,13 +757,18 @@ QPlainTextEdit {
selection-background-color: %1;
}

OutputScriptTextEdit {
OutputScriptTextEdit,
Natron--OutputScriptTextEdit {
color: %5;
background-color: %2;
selection-color: %8;
selection-background-color: %1;
}

QTextBrowser#TextBrowser {
color: %5;
}

/*
Color Selector Button/Widget
*/
Expand Down