mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Small fixes to status button
This commit is contained in:
parent
0b45edbfd1
commit
c5c0f35f59
1
res.qrc
1
res.qrc
|
@ -108,5 +108,6 @@
|
|||
<file>ui/statusButton/dot_idle.png</file>
|
||||
<file>ui/statusButton/dot_online.png</file>
|
||||
<file>ui/statusButton/statusButton.css</file>
|
||||
<file>ui/statusButton/menu_indicator.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
|
||||
QProgressBar {
|
||||
background-color: transparent;
|
||||
border: 1px solid black;
|
||||
border: 1px solid rgb(150,150,150);
|
||||
height: 11px;
|
||||
}
|
||||
|
||||
QProgressBar::chunk {
|
||||
background-color: black;
|
||||
background-color: rgb(150,150,150);
|
||||
width: 2px;
|
||||
}
|
BIN
ui/statusButton/menu_indicator.png
Normal file
BIN
ui/statusButton/menu_indicator.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 262 B |
|
@ -1,17 +1,41 @@
|
|||
QPushButton
|
||||
{
|
||||
background: none;
|
||||
background: none;
|
||||
background-color: rgb(65,65,65);
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
/*Disabled due to a bug preventing button status from
|
||||
resetting to default after menu item pressed
|
||||
QPushButton#online
|
||||
{
|
||||
image: url(":ui/statusButton/dot_online.png") center center;
|
||||
}
|
||||
|
||||
QPushButton#away
|
||||
{
|
||||
image: url(":ui/statusButton/dot_idle.png") center center;
|
||||
}
|
||||
|
||||
QPushButton#busy
|
||||
{
|
||||
image: url(":ui/statusButton/dot_busy.png") center center;
|
||||
}
|
||||
|
||||
QPushButton#offline
|
||||
{
|
||||
image: url(":ui/statusButton/dot_away.png") center center;
|
||||
}
|
||||
|
||||
QPushButton:default
|
||||
{
|
||||
background-color: rgb(65,65,65);
|
||||
}
|
||||
|
||||
/*Bugged in Qt, but it's probably better to leave enabled so that users can tell it's clickable*/
|
||||
QPushButton:hover
|
||||
{
|
||||
background-color: rgb(75,75,75);
|
||||
}*/
|
||||
}
|
||||
|
||||
QPushButton:pressed
|
||||
{
|
||||
|
@ -21,3 +45,14 @@ QPushButton:pressed
|
|||
QPushButton:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
QPushButton::menu-indicator {image: none;}
|
||||
|
||||
QPushButton::menu-indicator:pressed, QPushButton::menu-indicator:open
|
||||
{
|
||||
image: url(":ui/statusButton/menu_indicator.png");
|
||||
subcontrol-origin: padding;
|
||||
subcontrol-position: bottom center;
|
||||
position: relative;
|
||||
bottom: 2px;
|
||||
}
|
||||
|
|
13
widget.ui
13
widget.ui
|
@ -2026,19 +2026,24 @@ QSplitter:handle{
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="statusButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="res.qrc">
|
||||
<normaloff>:/ui/statusButton/dot_away.png</normaloff>:/ui/statusButton/dot_away.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>10</width>
|
||||
|
|
|
@ -156,6 +156,7 @@ Widget::Widget(QWidget *parent) :
|
|||
setStatusBusy->setIcon(QIcon(":ui/statusButton/dot_busy.png"));
|
||||
ui->statusButton->setMenu(statusButtonMenu);
|
||||
|
||||
|
||||
this->setMouseTracking(true);
|
||||
|
||||
QList<QWidget*> widgets = this->findChildren<QWidget*>();
|
||||
|
@ -315,14 +316,28 @@ void Widget::onFailedToStartCore()
|
|||
|
||||
void Widget::onStatusSet(Status status)
|
||||
{
|
||||
//We have to use stylesheets here, there's no way to
|
||||
//prevent the button icon from moving when pressed otherwise
|
||||
if (status == Status::Online)
|
||||
ui->statusButton->setIcon(QIcon(":ui/statusButton/dot_online.png"));
|
||||
{
|
||||
ui->statusButton->setObjectName("online");
|
||||
ui->statusButton->style()->polish(ui->statusButton);
|
||||
}
|
||||
else if (status == Status::Away)
|
||||
ui->statusButton->setIcon(QIcon(":ui/statusButton/dot_idle.png"));
|
||||
{
|
||||
ui->statusButton->setObjectName("away");
|
||||
ui->statusButton->style()->polish(ui->statusButton);
|
||||
}
|
||||
else if (status == Status::Busy)
|
||||
ui->statusButton->setIcon(QIcon(":ui/statusButton/dot_busy.png"));
|
||||
{
|
||||
ui->statusButton->setObjectName("busy");
|
||||
ui->statusButton->style()->polish(ui->statusButton);
|
||||
}
|
||||
else if (status == Status::Offline)
|
||||
ui->statusButton->setIcon(QIcon(":ui/statusButton/dot_away.png"));
|
||||
{
|
||||
ui->statusButton->setObjectName("offline");
|
||||
ui->statusButton->style()->polish(ui->statusButton);
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::onAddClicked()
|
||||
|
|
Loading…
Reference in New Issue
Block a user