Skip to content

Commit 985ff74

Browse files
authored
feat: config flag to avoid QtADS using Qt StyleSheet (#835)
Resolve: #833
1 parent a9aa10f commit 985ff74

3 files changed

Lines changed: 15 additions & 2 deletions

File tree

demo/MainWindow.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,9 @@ CMainWindow::CMainWindow(QWidget *parent) :
779779
// uncomment if you would like to close tabs with the middle mouse button, web browser style
780780
// CDockManager::setConfigFlag(CDockManager::MiddleMouseButtonClosesTab, true);
781781

782+
// uncomment if you would like to avoid using the built-in QSS stylesheet
783+
// CDockManager::setConfigFlag(CDockManager::DisableStylesheet, true);
784+
782785
// Now create the dock manager and its content
783786
d->DockManager = new CDockManager(this);
784787
d->DockManager->setDockWidgetToolBarStyle(Qt::ToolButtonIconOnly, ads::CDockWidget::StateFloating);

src/DockManager.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,10 @@ DockManagerPrivate::DockManagerPrivate(CDockManager* _public) :
203203
//============================================================================
204204
void DockManagerPrivate::loadStylesheet()
205205
{
206+
if (CDockManager::testConfigFlag(CDockManager::DisableStylesheet))
207+
{
208+
return;
209+
}
206210
initResource();
207211
QString Result;
208212
QString FileName = ":ads/stylesheets/";

src/DockManager.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,13 @@ struct AutoHideTabPrivate;
6464
* of the docking system. The dock manager uses an internal stylesheet to
6565
* style its components like splitters, tabs and buttons. If you want to
6666
* disable this stylesheet because your application uses its own,
67-
* just call the function for settings the stylesheet with an empty
68-
* string.
67+
* you can either set the DisableStylesheet config flag before creating
68+
* the dock manager:
69+
* \code
70+
* CDockManager::setConfigFlag(CDockManager::DisableStylesheet, true);
71+
* \endcode
72+
* Or call the function for settings the stylesheet with an empty string
73+
* after creating the dock manager:
6974
* \code
7075
* DockManager->setStyleSheet("");
7176
* \endcode
@@ -218,6 +223,7 @@ public Q_SLOTS:
218223
DoubleClickUndocksWidget = 0x10000000, //!< If the flag is set, a double click on a tab undocks the widget
219224
TabsAtBottom = 0x20000000, //!< If the flag is set, tabs will be shown at the bottom instead of in the title bar.
220225
UseNativeWindows = 0x40000000, //!< If the flag is set, windows for the dock and area widgets will be native.
226+
DisableStylesheet = 0x80000000, //!< If the flag is set, the dock manager will not apply the default stylesheet
221227

222228

223229
DefaultDockAreaButtons = DockAreaHasCloseButton

0 commit comments

Comments
 (0)