Krita Source Code Documentation
Loading...
Searching...
No Matches
WdgSide Class Reference

#include <wdg_side.h>

+ Inheritance diagram for WdgSide:

Public Slots

void focusLabel (int id)
 

Public Member Functions

 WdgSide (KoResourceBundleSP bundle, QWidget *parent=nullptr)
 
 ~WdgSide ()
 

Private Attributes

KoResourceBundleSP m_bundle
 
Ui::WdgSide * m_ui
 

Detailed Description

Definition at line 17 of file wdg_side.h.

Constructor & Destructor Documentation

◆ WdgSide()

WdgSide::WdgSide ( KoResourceBundleSP bundle,
QWidget * parent = nullptr )
explicit

Definition at line 16 of file wdg_side.cpp.

16 :
17 QWidget(parent),
18 m_ui(new Ui::WdgSide)
19 , m_bundle(bundle)
20{
21 m_ui->setupUi(this);
22
23 QCoreApplication* coreApp = QCoreApplication::instance();
24 QApplication* app = qobject_cast<QApplication*>(coreApp);
25 QPalette appPalette = app->palette();
26 QColor brightColor = appPalette.color(QPalette::Highlight);
27 QString styleSheet = QString("QToolButton { background-color: %1; color: %2; }")
28 .arg(brightColor.name())
29 .arg(brightColor.lightnessF() < 0.5 ? "#FFFFFF" : "#000000");
30
31 m_ui->btnChooseRes->setIcon(KisIconUtils::loadIcon("document-edit"));
32 m_ui->btnChooseRes->setIconSize(QSize(28, 28));
33 m_ui->btnChooseRes->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
34
35 m_ui->btnChooseTags->setIcon(KisIconUtils::loadIcon("bookmarks"));
36 m_ui->btnChooseTags->setIconSize(QSize(28, 28));
37 m_ui->btnChooseTags->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
38
39 m_ui->btnBundleInfo->setIcon(KisIconUtils::loadIcon("configure"));
40 m_ui->btnBundleInfo->setIconSize(QSize(28, 28));
41 m_ui->btnBundleInfo->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
42
43 m_ui->btnSaveLocation->setIcon(KisIconUtils::loadIcon("folder"));
44 m_ui->btnSaveLocation->setIconSize(QSize(28, 28));
45 m_ui->btnSaveLocation->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
46
47 m_ui->btnChooseRes->setStyleSheet(styleSheet);
48}
Ui::WdgSide * m_ui
Definition wdg_side.h:26
KoResourceBundleSP m_bundle
Definition wdg_side.h:32
QIcon loadIcon(const QString &name)

References KisIconUtils::loadIcon(), and m_ui.

◆ ~WdgSide()

WdgSide::~WdgSide ( )

Definition at line 99 of file wdg_side.cpp.

100{
101 delete m_ui;
102}

References m_ui.

Member Function Documentation

◆ focusLabel

void WdgSide::focusLabel ( int id)
slot

Definition at line 50 of file wdg_side.cpp.

51{
52 QCoreApplication* coreApp = QCoreApplication::instance();
53 QApplication* app = qobject_cast<QApplication*>(coreApp);
54 QPalette appPalette = app->palette();
55 QColor brightColor = appPalette.color(QPalette::Midlight);
56 QString styleSheetHighlight = QString("QToolButton { background-color: %1; color: %2; }")
57 .arg(brightColor.name())
58 .arg(brightColor.lightnessF() < 0.5 ? "#FFFFFF" : "#000000");
59
60 QColor normalColor = appPalette.color(QPalette::Base);
61 QString styleSheetNormal = QString("QToolButton { background-color: %1; color: %2; }")
62 .arg(normalColor.name())
63 .arg(normalColor.lightnessF() < 0.5 ? "#FFFFFF" : "#000000");
64
65
66 switch(id) {
67 case 1: {
68 m_ui->btnChooseRes->setStyleSheet(styleSheetHighlight);
69 m_ui->btnChooseTags->setStyleSheet(styleSheetNormal);
70 m_ui->btnBundleInfo->setStyleSheet(styleSheetNormal);
71 m_ui->btnSaveLocation->setStyleSheet(styleSheetNormal);
72 break;
73 }
74 case 2: {
75 m_ui->btnChooseRes->setStyleSheet(styleSheetNormal);
76 m_ui->btnChooseTags->setStyleSheet(styleSheetHighlight);
77 m_ui->btnBundleInfo->setStyleSheet(styleSheetNormal);
78 m_ui->btnSaveLocation->setStyleSheet(styleSheetNormal);
79 break;
80 }
81 case 3: {
82 m_ui->btnChooseRes->setStyleSheet(styleSheetNormal);
83 m_ui->btnChooseTags->setStyleSheet(styleSheetNormal);
84 m_ui->btnBundleInfo->setStyleSheet(styleSheetHighlight);
85 m_ui->btnSaveLocation->setStyleSheet(styleSheetNormal);
86 break;
87 }
88 case 4: {
89 m_ui->btnChooseRes->setStyleSheet(styleSheetNormal);
90 m_ui->btnChooseTags->setStyleSheet(styleSheetNormal);
91 m_ui->btnBundleInfo->setStyleSheet(styleSheetNormal);
92 m_ui->btnSaveLocation->setStyleSheet(styleSheetHighlight);
93 break;
94 }
95 }
96
97}

References m_ui.

Member Data Documentation

◆ m_bundle

KoResourceBundleSP WdgSide::m_bundle
private

Definition at line 32 of file wdg_side.h.

◆ m_ui

Ui::WdgSide* WdgSide::m_ui
private

Definition at line 26 of file wdg_side.h.


The documentation for this class was generated from the following files: