Skip to content

Commit

Permalink
Added new button style
Browse files Browse the repository at this point in the history
  • Loading branch information
bugraonal committed Apr 5, 2021
1 parent 78a23d7 commit dd10ad5
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 2 deletions.
12 changes: 12 additions & 0 deletions forms/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="switchGroup">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string/>
</property>
Expand Down Expand Up @@ -133,6 +139,12 @@
</item>
<item row="1" column="1">
<widget class="QGroupBox" name="buttonGroup">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string/>
</property>
Expand Down
8 changes: 8 additions & 0 deletions include/indexedbutton.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,16 @@ class IndexedButton : public QPushButton
: QPushButton(parent)
, index(index)
{
//this->setFixedWidth(20);
connect(this, &QPushButton::pressed, this, &IndexedButton::handleClick);
connect(this, &QPushButton::released, this, &IndexedButton::handleClick);
setStyleSheet("QPushButton {"
" min-width: 30px;"
" max-width: 30px;"
" height: 50px;"
"}"
"QPushButton {border-image: url(:/images/images/button_unpressed.png);}"
"QPushButton:pressed {border-image: url(:/images/images/button_pressed.png);}");
};
;

Expand Down
2 changes: 1 addition & 1 deletion include/indexedswitch.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class IndexedSwitch : public QCheckBox
{
connect(this, &QCheckBox::clicked, this, &IndexedSwitch::handleClick);
setStyleSheet("QCheckBox::indicator {"
" width: 20px;"
" width: 30px;"
" height: 60px;"
"}"
"QCheckBox::indicator:checked {image: url(:/images/images/switch_on.png);}"
Expand Down
2 changes: 1 addition & 1 deletion include/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
#define VERSION_H


#define VERSION "1.1.3"
#define VERSION "1.1.4"

#endif // VERSION_H
Binary file added resources/images/button_pressed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/images/button_unpressed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions resources/resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<qresource prefix="/images">
<file>images/switch_on.png</file>
<file>images/switch_off.png</file>
<file>images/button_pressed.png</file>
<file>images/button_unpressed.png</file>
</qresource>
<qresource prefix="/projectFiles">
<file>projectFiles/CMakeLists.txt</file>
Expand Down

0 comments on commit dd10ad5

Please sign in to comment.