Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
39ed185f
Commit
39ed185f
authored
Jun 11, 2019
by
Christoffer Ackelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
QT: Style changes on the operator row.
parent
76859dba
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
108 deletions
+76
-108
xtt/lib/xtt/qt/xtt_op_qt.cqt
xtt/lib/xtt/qt/xtt_op_qt.cqt
+68
-97
xtt/lib/xtt/qt/xtt_op_qt.h
xtt/lib/xtt/qt/xtt_op_qt.h
+8
-11
No files found.
xtt/lib/xtt/qt/xtt_op_qt.cqt
View file @
39ed185f
...
...
@@ -60,7 +60,7 @@
#include <QDesktopWidget>
#include <QPushButton>
#define OP_HEIGHT_MIN
105
#define OP_HEIGHT_MIN
90
#define OP_HEIGHT_INC 20
#define OP_HEIGHT_STATUSBAR 20
...
...
@@ -92,7 +92,7 @@ static void cnv_qt_text(char* in, char* out, int size)
*t = 0;
}
static void modifyBackground(QWidget* widget, QColor
&
color)
static void modifyBackground(QWidget* widget, QColor color)
{
QPalette pal = widget->palette();
pal.setColor(QPalette::Background, color);
...
...
@@ -100,31 +100,41 @@ static void modifyBackground(QWidget* widget, QColor& color)
widget->setAutoFillBackground(true);
}
static void modify
Foreground(QWidget* widget, QColor& color
)
static void modify
Background(QWidget* widget, QColor bg, QColor fg
)
{
QPalette pal = widget->palette();
pal.setColor(QPalette::Foreground, color);
pal.setColor(QPalette::ButtonText, color);
pal.setColor(QPalette::Background, bg);
pal.setColor(QPalette::Foreground, fg);
pal.setColor(QPalette::ButtonText, fg);
widget->setPalette(pal);
widget->setAutoFillBackground(true);
}
void OpQt::alarm_box_helper(int i
)
QVBoxLayout* OpQt::alarm_box_helper(
)
{
QHBoxLayout* aalarm_box_layout = new QHBoxLayout();
QWidget* aalarm_bbox1 = new QWidget();
modifyBackground(aalarm_label[i], red_color);
aalarm_info[i] = image_button(toplevel, "$pwr_exe/xtt_alarm_info.png");
fixed_put(aalarm_bbox1, aalarm_active[i], 0, 0);
fixed_put(aalarm_bbox1, aalarm_info[i], 21, 0);
fixed_put(aalarm_bbox1, new QLabel(""), 43, 0);
aalarm_box_layout->addWidget(aalarm_bbox1);
add_expanding(aalarm_box_layout, aalarm_label[i]);
aalarm_box[i] = layout_to_widget(aalarm_box_layout);
aalarm_label[i]->setFixedHeight(20);
aalarm_active[i]->setFixedHeight(20);
aalarm_info[i]->setFixedSize(20, 20);
QObject::connect(
aalarm_info[i], SIGNAL(clicked()), toplevel, SLOT(activate_info()));
QVBoxLayout* vbox = new QVBoxLayout();
for (int i = 0; i < 5; i++) {
QHBoxLayout* aalarm_box_layout = new QHBoxLayout();
aalarm_active[i] = new QLabel(toplevel);
aalarm_active[i]->setFixedSize(20, 20);
aalarm_active[i]->setPixmap(active_pixmap);
aalarm_box_layout->addWidget(aalarm_active[i]);
aalarm_info[i] = image_button(toplevel, "$pwr_exe/xtt_alarm_info.png");
aalarm_info[i]->setFixedSize(20, 20);
QObject::connect(
aalarm_info[i], SIGNAL(clicked()), toplevel, SLOT(activate_info()));
aalarm_box_layout->addWidget(aalarm_info[i]);
aalarm_label[i] = new QLabel("");
aalarm_label[i]->setFixedHeight(20);
modifyBackground(aalarm_label[i], QColor(255, 117, 117));
add_expanding(aalarm_box_layout, aalarm_label[i]);
aalarm_box[i] = layout_to_widget(aalarm_box_layout);
vbox->addWidget(aalarm_box[i]);
}
return vbox;
}
ClickableFrame::ClickableFrame() : QFrame() {}
...
...
@@ -144,11 +154,6 @@ OpQt::OpQt(void* op_parent_ctx, char* opplace, pwr_tStatus* status)
memset(a_active, 0, sizeof(a_active));
memset(appl_buttons, 0, sizeof(appl_buttons));
red_color = QColor("#FF7575");
yellow_color = QColor("yellow");
green_color = QColor("green");
gray_color = QColor("gray");
toplevel = new OpQtWidget(this);
toplevel->setMinimumSize(1100, OP_HEIGHT_MIN + OP_HEIGHT_STATUSBAR);
toplevel->setWindowFlags(Qt::CustomizeWindowHint);
...
...
@@ -156,26 +161,23 @@ OpQt::OpQt(void* op_parent_ctx, char* opplace, pwr_tStatus* status)
CoWowQt::SetWindowIcon(toplevel);
QRect xtt_monitor_geometry = QApplication::desktop()->screenGeometry();
for (int i = 0; i < 5; i++) {
aalarm_active[i] = new_image_label(toplevel, "$pwr_exe/xtt_alarm_active.png");
aalarm_label[i] = new QLabel("");
}
pwr_tFileName fname;
dcli_translate_filename(fname, "$pwr_exe/xtt_alarm_active.png");
active_pixmap = QPixmap(fl(fname));
alarmcnt_label = new QLabel("");
aalarm_mark = new QLabel("A");
balarm_active = new_image_label(toplevel, "$pwr_exe/xtt_alarm_active.png");
balarm_active = new QLabel(toplevel);
balarm_active->setPixmap(active_pixmap);
balarm_mark = new QLabel("");
balarm_label = new QLabel("");
QVBoxLayout* vbox_aalarm = new QVBoxLayout();
for (int i = 0; i < 5; i++) {
alarm_box_helper(i);
vbox_aalarm->addWidget(aalarm_box[i]);
}
QVBoxLayout* vbox_aalarm = alarm_box_helper();
balarm_active->setFixedSize(20, 20);
balarm_info = image_button(toplevel, "$pwr_exe/xtt_alarm_info.png");
info_icon = QIcon(balarm_info->icon());
QHBoxLayout* balarm_box_layout = new QHBoxLayout();
QWidget* balarm_bbox = new QWidget();
...
...
@@ -228,11 +230,13 @@ OpQt::OpQt(void* op_parent_ctx, char* opplace, pwr_tStatus* status)
QHBoxLayout* hbox_decrbutton = new QHBoxLayout();
hbox_decrbutton->addWidget(decr_button);
hbox_decrbutton->setAlignment(decr_button, Qt::AlignLeft);
QVBoxLayout* vbox_abutton = new QVBoxLayout();
vbox_abutton->addLayout(hbox_abutton);
vbox_abutton->addLayout(hbox_incrbutton);
vbox_abutton->addLayout(hbox_decrbutton);
vbox_abutton->addStretch(1);
QHBoxLayout* hbox_bbutton = new QHBoxLayout();
hbox_bbutton->addWidget(balarm_ack);
...
...
@@ -247,7 +251,8 @@ OpQt::OpQt(void* op_parent_ctx, char* opplace, pwr_tStatus* status)
add_expanding(hbox_b, balarm_box);
QVBoxLayout* vbox_ala = new QVBoxLayout();
add_expanding(vbox_ala, hbox_a);
vbox_ala->addLayout(hbox_a);
vbox_ala->addStretch(1);
vbox_ala->addWidget(separator(QFrame::HLine));
vbox_ala->addLayout(hbox_b);
...
...
@@ -400,10 +405,8 @@ OpQt::OpQt(void* op_parent_ctx, char* opplace, pwr_tStatus* status)
QHBoxLayout* node_hbox = new QHBoxLayout();
QFrame* node_ind = new QFrame();
modifyBackground(node_ind, gray_color);
node_ind->setFixedSize(20, 20);
QColor black = QColor("black");
modifyForeground(node_ind, black);
modifyBackground(node_ind, QColor(160, 160, 160), QColor(0, 0, 0));
node_ind->setFrameStyle(QFrame::Box | QFrame::Plain);
node_ind->setLineWidth(1);
...
...
@@ -573,8 +576,6 @@ void OpQt::update_alarm_info()
return;
}
QColor bg_color = QColor("gray");
height = 22;
active_height = 22;
...
...
@@ -618,20 +619,15 @@ void OpQt::update_alarm_info()
if (i < a_height) {
aalarm_box[i]->setVisible(true);
if (info.a_alarm_active[i]) {
aalarm_active[i]->setVisible(true);
} else {
aalarm_active[i]->setVisible(false);
}
if (!streq(info.a_alarm_moretext[i], "")) {
aalarm_info[i]->setVisible(true);
} else {
aalarm_info[i]->setVisible(false);
}
aalarm_active[i]->setPixmap(info.a_alarm_active[i] ? active_pixmap : QPixmap());
bool enable = !streq(info.a_alarm_moretext[i], "");
aalarm_info[i]->setIcon(enable ? info_icon : QIcon());
aalarm_info[i]->setEnabled(enable);
aalarm_info[i]->setFlat(!enable);
}
} else {
aalarm_label[i]->setText("");
aalarm_active[i]->set
Visible(false
);
aalarm_active[i]->set
Pixmap(QPixmap()
);
aalarm_box[i]->setVisible(false);
}
}
...
...
@@ -658,7 +654,7 @@ void OpQt::update_alarm_info()
}
balarm_label->setText(convert_utf8(text));
modifyBackground(balarm_box,
yellow_color
);
modifyBackground(balarm_box,
QColor(255, 255, 0)
);
balarm_box->setVisible(true);
balarm_mark->setText(fl("B"));
...
...
@@ -674,8 +670,6 @@ void OpQt::update_alarm_info()
balarm_info->setVisible(false);
}
} else if (info.c_alarm_exist[0]) {
QColor blue_color("lightblue");
balarm_type = evlist_eEventType_Alarm;
balarm_prio = mh_eEventPrio_C;
strcpy(b_alarm_moretext, info.c_alarm_moretext[0]);
...
...
@@ -694,7 +688,7 @@ void OpQt::update_alarm_info()
info.c_alarm_alias[0], ctext);
}
balarm_label->setText(convert_utf8(text));
modifyBackground(balarm_box,
blue_color
);
modifyBackground(balarm_box,
QColor(0, 255, 255)
);
balarm_box->setVisible(true);
balarm_mark->setText(fl("C"));
...
...
@@ -710,8 +704,6 @@ void OpQt::update_alarm_info()
balarm_info->setVisible(false);
}
} else if (info.d_alarm_exist[0]) {
QColor violet_color("violet");
balarm_type = evlist_eEventType_Alarm;
balarm_prio = mh_eEventPrio_D;
strcpy(b_alarm_moretext, info.d_alarm_moretext[0]);
...
...
@@ -730,7 +722,7 @@ void OpQt::update_alarm_info()
info.d_alarm_alias[0], ctext);
}
balarm_label->setText(convert_utf8(text));
modifyBackground(balarm_box,
violet_color
);
modifyBackground(balarm_box,
QColor(255, 128, 255)
);
balarm_box->setVisible(true);
balarm_mark->setText(fl("D"));
...
...
@@ -764,10 +756,9 @@ void OpQt::update_alarm_info()
}
balarm_label->setText(convert_utf8(text));
if (balarm_type == evlist_eEventType_InfoSuccess) {
modifyBackground(balarm_box,
green_color
);
modifyBackground(balarm_box,
QColor(0, 255, 0)
);
} else {
QColor white = QColor("white");
modifyBackground(balarm_box, white);
modifyBackground(balarm_box, QColor(255, 255, 255));
}
balarm_box->setVisible(true);
...
...
@@ -785,7 +776,7 @@ void OpQt::update_alarm_info()
}
} else {
balarm_label->setText("");
modifyBackground(balarm_box,
bg_color
);
modifyBackground(balarm_box,
QColor(160, 160, 160)
);
balarm_mark->setText("");
balarm_box->setVisible(false);
...
...
@@ -978,7 +969,7 @@ void OpQtWidget::activate_aalarm_incr()
}
op->a_height++;
height = OP_HEIGHT_MIN + (op->a_height -
2
) * OP_HEIGHT_INC
height = OP_HEIGHT_MIN + (op->a_height -
3
) * OP_HEIGHT_INC
+ ((op->layout_mask & pwr_mOpWindLayoutMask_HideStatusBar) ? 0 : 1)
* OP_HEIGHT_STATUSBAR;
...
...
@@ -993,11 +984,7 @@ void OpQtWidget::activate_aalarm_incr()
if (i < op->a_height) {
if (op->a_exist[i]) {
op->aalarm_box[i]->setVisible(true);
if (op->a_active[i]) {
op->aalarm_active[i]->setVisible(true);
} else {
op->aalarm_active[i]->setVisible(false);
}
op->aalarm_active[i]->setPixmap(op->a_active[i] ? op->active_pixmap : QPixmap());
}
}
}
...
...
@@ -1014,7 +1001,7 @@ void OpQtWidget::activate_aalarm_decr()
}
op->a_height--;
height = OP_HEIGHT_MIN + (op->a_height -
2
) * OP_HEIGHT_INC
height = OP_HEIGHT_MIN + (op->a_height -
3
) * OP_HEIGHT_INC
+ ((op->layout_mask & pwr_mOpWindLayoutMask_HideStatusBar) ? 0 : 1)
* OP_HEIGHT_STATUSBAR;
...
...
@@ -1029,8 +1016,6 @@ void OpQtWidget::activate_aalarm_decr()
if (i >= op->a_height) {
if (op->a_exist[i]) {
op->aalarm_box[i]->setVisible(false);
op->aalarm_active[i]->setVisible(false);
op->aalarm_info[i]->setVisible(false);
}
}
}
...
...
@@ -1179,30 +1164,16 @@ int OpQt::get_cmd(QMenu* w, char* cmd)
void OpQt::change_sup_color(void* imagew, op_eSupColor color)
{
QColor* col;
switch (color) {
case op_eSupColor_Gray:
col = &gray_color;
break;
case op_eSupColor_Green:
col = &green_color;
break;
case op_eSupColor_Yellow:
col = &yellow_color;
break;
case op_eSupColor_Red:
col = &red_color;
break;
case op_eSupColor_Black:
col = &gray_color;
break;
default:
col = &gray_color;
QColor col(160, 160, 160);
if (color == op_eSupColor_Green) {
col = QColor(0, 255, 0);
} else if (color == op_eSupColor_Yellow) {
col = QColor(255, 255, 0);
} else if (color == op_eSupColor_Red) {
col = QColor(255, 117, 117);
}
QColor black = QColor("black");
modifyBackground((QWidget*)imagew, *col);
modifyForeground((QWidget*)imagew, black);
modifyBackground((QWidget*)imagew, col, QColor(0, 0, 0));
}
void OpQt::set_title(char* user)
...
...
@@ -1245,4 +1216,4 @@ void OpQt::set_text_size()
appl_buttons[i]->setFont(fd);
}
}
}
\ No newline at end of file
}
xtt/lib/xtt/qt/xtt_op_qt.h
View file @
39ed185f
...
...
@@ -71,12 +71,12 @@ public:
QLabel
*
alarmcnt_label
;
QWidget
*
aalarm_mark
;
QLabel
*
aalarm_label
[
5
];
Q
Widget
*
aalarm_active
[
5
];
Q
Widget
*
aalarm_info
[
5
];
Q
Label
*
aalarm_active
[
5
];
Q
PushButton
*
aalarm_info
[
5
];
QWidget
*
aalarm_box
[
5
];
QLabel
*
balarm_label
;
Q
Widget
*
balarm_active
;
Q
Widget
*
balarm_info
;
Q
Label
*
balarm_active
;
Q
PushButton
*
balarm_info
;
QWidget
*
balarm_box
;
QLabel
*
balarm_mark
;
QVBoxLayout
*
appl_form
;
...
...
@@ -89,11 +89,8 @@ public:
QPushButton
*
appl_buttons
[
25
];
QToolBar
*
tools
;
QToolBar
*
tools2
;
QColor
red_color
;
QColor
yellow_color
;
QColor
green_color
;
QColor
gray_color
;
QColor
white_color
;
QPixmap
active_pixmap
;
QIcon
info_icon
;
int
a_height
;
int
a_exist
[
5
];
int
a_active
[
5
];
...
...
@@ -117,7 +114,7 @@ public:
void
set_text_size
();
private:
void
alarm_box_helper
(
int
i
);
QVBoxLayout
*
alarm_box_helper
(
);
OpQtWidget
*
toplevel
;
};
...
...
@@ -178,4 +175,4 @@ protected:
void
mousePressEvent
(
QMouseEvent
*
event
);
};
#endif
\ No newline at end of file
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment