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
d1b52cf9
Commit
d1b52cf9
authored
Aug 15, 2018
by
Christoffer Ackelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a class that can be used to modify the style of QT widgets.
parent
a468c5aa
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
161 additions
and
37 deletions
+161
-37
profibus/exe/profinet_viewer/qt/profinet_viewer_qt.cpp
profibus/exe/profinet_viewer/qt/profinet_viewer_qt.cpp
+2
-0
sev/exe/sev_xtt/qt/sev_xtt_qt.cpp
sev/exe/sev_xtt/qt/sev_xtt_qt.cpp
+3
-0
wb/exe/wb/qt/wb_qt.cpp
wb/exe/wb/qt/wb_qt.cpp
+3
-3
wb/exe/wb_cmd/qt/wb_cmd_qt.cpp
wb/exe/wb_cmd/qt/wb_cmd_qt.cpp
+3
-0
wb/lib/wb/qt/wb_nav_qt.cqt
wb/lib/wb/qt/wb_nav_qt.cqt
+5
-3
wb/lib/wb/qt/wb_pal_qt.cqt
wb/lib/wb/qt/wb_pal_qt.cqt
+6
-4
wb/lib/wb/qt/wb_utl_qt.cpp
wb/lib/wb/qt/wb_utl_qt.cpp
+2
-0
wb/lib/wb/qt/wb_wnav_qt.cqt
wb/lib/wb/qt/wb_wnav_qt.cqt
+11
-10
wb/lib/wb/qt/wb_wnav_qt.h
wb/lib/wb/qt/wb_wnav_qt.h
+0
-1
wb/lib/wb/qt/wb_wtt_qt.cqt
wb/lib/wb/qt/wb_wtt_qt.cqt
+1
-1
xtt/exe/co_help/qt/co_help_qt.cpp
xtt/exe/co_help/qt/co_help_qt.cpp
+2
-0
xtt/exe/pwr_rtmon/qt/pwr_rtmon_qt.cpp
xtt/exe/pwr_rtmon/qt/pwr_rtmon_qt.cpp
+2
-0
xtt/exe/rt_statusmon/qt/rt_statusmon_qt.cpp
xtt/exe/rt_statusmon/qt/rt_statusmon_qt.cpp
+2
-0
xtt/exe/rt_xtt/qt/rt_xtt_qt.cqt
xtt/exe/rt_xtt/qt/rt_xtt_qt.cqt
+2
-0
xtt/exe/rt_xtt_cmd/qt/rt_xtt_cmd_qt.cpp
xtt/exe/rt_xtt_cmd/qt/rt_xtt_cmd_qt.cpp
+2
-0
xtt/exe/wb_ge/qt/wb_ge_qt.cpp
xtt/exe/wb_ge/qt/wb_ge_qt.cpp
+2
-0
xtt/lib/cow/qt/cow_style_qt.cqt
xtt/lib/cow/qt/cow_style_qt.cqt
+50
-0
xtt/lib/cow/qt/cow_style_qt.h
xtt/lib/cow/qt/cow_style_qt.h
+53
-0
xtt/lib/glow/qt/glow_draw_qt.cqt
xtt/lib/glow/qt/glow_draw_qt.cqt
+10
-15
No files found.
profibus/exe/profinet_viewer/qt/profinet_viewer_qt.cpp
View file @
d1b52cf9
...
...
@@ -41,6 +41,7 @@
#include "co_error.h"
#include "cow_qt_helpers.h"
#include "cow_style_qt.h"
#include "cow_xhelp_qt.h"
#include "pn_viewer_qt.h"
...
...
@@ -70,6 +71,7 @@ int main(int argc, char* argv[])
char
dev_name
[
20
]
=
"eth1"
;
QApplication
app
(
argc
,
argv
);
QApplication
::
setStyle
(
new
PwrStyle
());
ctx
=
(
tViewer
*
)
calloc
(
1
,
sizeof
(
tViewer
));
...
...
sev/exe/sev_xtt/qt/sev_xtt_qt.cpp
View file @
d1b52cf9
...
...
@@ -36,6 +36,8 @@
#include "co_error.h"
#include "cow_style_qt.h"
#include "xtt_tbl_qt.h"
#include <QApplication>
...
...
@@ -84,6 +86,7 @@ int main(int argc, char* argv[])
}
QApplication
app
(
argc
,
argv
);
QApplication
::
setStyle
(
new
PwrStyle
());
setlocale
(
LC_NUMERIC
,
"POSIX"
);
setlocale
(
LC_TIME
,
"en_US"
);
...
...
wb/exe/wb/qt/wb_qt.cpp
View file @
d1b52cf9
...
...
@@ -45,6 +45,7 @@
#include "cow_login_qt.h"
#include "cow_msgwindow_qt.h"
#include "cow_qt_helpers.h"
#include "cow_style_qt.h"
#include "cow_xhelp_qt.h"
#include "wb_erep.h"
...
...
@@ -85,10 +86,9 @@ int main(int argc, char* argv[])
}
QApplication
app
(
argc
,
argv
);
QApplication
::
setStyle
(
new
PwrStyle
());
WbQt
(
argc
,
argv
);
int
res
=
app
.
exec
();
debug_print
(
"app.exec() finished executing!
\n
"
);
return
res
;
return
app
.
exec
();
}
WbQt
::
WbQt
(
int
argc
,
char
*
argv
[])
:
mainwindow
(
0
)
...
...
wb/exe/wb_cmd/qt/wb_cmd_qt.cpp
View file @
d1b52cf9
...
...
@@ -40,6 +40,8 @@
#include <stdlib.h>
#include <string.h>
#include "cow_style_qt.h"
#include "wb_log_qt.h"
#include "wb_wnav_qt.h"
...
...
@@ -76,6 +78,7 @@ CmdQt::CmdQt(int argc, char* argv[])
int
main
(
int
argc
,
char
*
argv
[])
{
QApplication
app
(
argc
,
argv
);
QApplication
::
setStyle
(
new
PwrStyle
());
new
CmdQt
(
argc
,
argv
);
return
app
.
exec
();
}
\ No newline at end of file
wb/lib/wb/qt/wb_nav_qt.cqt
View file @
d1b52cf9
...
...
@@ -42,6 +42,8 @@
#include "wb_nav_qt.h"
#include <QScrollArea>
#include <qlocalsocket.h>
NavQt::NavQt(void* nav_parent_ctx, QWidget* nav_parent_wid,
...
...
@@ -52,10 +54,10 @@ NavQt::NavQt(void* nav_parent_ctx, QWidget* nav_parent_wid,
trace_obj = new NavQtTraceObject(this);
debug_print("creating a scrolledbrowwidgetqt\n");
QWidget* scrolledbrow
= scrolledbrowwidgetqt_new(Nav::init_brow_cb, this, &brow_widget);
QScrollArea* scrolledbrow = ((QScrollArea*) scrolledbrowwidgetqt_new(Nav::init_brow_cb, this, &brow_widget));
scrolledbrow->setStyleSheet("QMainWindow{border: 3px solid black;}");
scrolledbrow->setFrameShape(QFrame::Box);
scrolledbrow->setLineWidth(3);
form_widget = scrolledbrow;
...
...
wb/lib/wb/qt/wb_pal_qt.cqt
View file @
d1b52cf9
...
...
@@ -42,6 +42,8 @@
#include "wb_pal_qt.h"
#include <QScrollArea>
#include <qlocalsocket.h>
PalQt::PalQt(void* pal_parent_ctx, QWidget* pal_parent_wid,
...
...
@@ -52,15 +54,15 @@ PalQt::PalQt(void* pal_parent_ctx, QWidget* pal_parent_wid,
trace_obj = new PalQtTraceObject(this);
debug_print("creating a scrolledbrowwidgetqt\n");
QWidget* scrolledbrow
= scrolledbrowwidgetqt_new(Pal::init_brow_cb, this, &brow_widget);
QScrollArea* scrolledbrow = ((QScrollArea*) scrolledbrowwidgetqt_new(Pal::init_brow_cb, this, &brow_widget));
brow_widget->setToolTip(fl("PalQt"));
showNow(brow_widget);
scrolledbrow->setFrameShape(QFrame::Box);
scrolledbrow->setLineWidth(3);
form_widget = scrolledbrow;
form_widget->setStyleSheet("QMainWindow{border: 3px solid black;}"
);
showNow(brow_widget
);
server = new QLocalServer(trace_obj);
server->listen("STRING");
...
...
wb/lib/wb/qt/wb_utl_qt.cpp
View file @
d1b52cf9
...
...
@@ -41,6 +41,7 @@
#include <string.h>
#include "cow_qt_helpers.h"
#include "cow_style_qt.h"
#include "wb_foe_msg.h"
#include "wb_foe_qt.h"
...
...
@@ -108,6 +109,7 @@ int wb_utl_qt::create_mainwindow(int argc, char** argv)
if
(
!
qt_initialized
)
{
QApplication
app
(
argc
,
argv
);
QApplication
::
setStyle
(
new
PwrStyle
());
qt_initialized
=
1
;
app
.
exec
();
}
...
...
wb/lib/wb/qt/wb_wnav_qt.cqt
View file @
d1b52cf9
...
...
@@ -68,7 +68,7 @@
void WNavQt::pop()
{
::pop(
toplevel
);
::pop(
form_widget
);
}
WNavQt::WNavQt(void* xn_parent_ctx, QWidget* xn_parent_wid, const char* xn_name,
...
...
@@ -92,10 +92,12 @@ WNavQt::WNavQt(void* xn_parent_ctx, QWidget* xn_parent_wid, const char* xn_name,
scrolledbrow->setFrameShape(QFrame::Box);
scrolledbrow->setLineWidth(3);
form_widget = scrolledbrow;
showNow(brow_widget);
// Create the root item
*w =
scrolledbrow
;
*w =
form_widget
;
serverString = new QLocalServer(trace_obj);
serverString->listen("STRING");
...
...
@@ -113,7 +115,7 @@ WNavQt::WNavQt(void* xn_parent_ctx, QWidget* xn_parent_wid, const char* xn_name,
serverAttrRef->listen("PWR_ATTRREF");
QObject::connect(serverAttrRef, SIGNAL(newConnection()), trace_obj,
SLOT(sel_convert_cb()));
gbl.load_config(this);
if (root_menu && !ldhses) {
...
...
@@ -122,8 +124,7 @@ WNavQt::WNavQt(void* xn_parent_ctx, QWidget* xn_parent_wid, const char* xn_name,
wow = new CoWowQt(parent_wid);
toplevel = scrolledbrow;
toplevel->setToolTip(fl("wb_wnav widget"));
form_widget->setToolTip(fl("wb_wnav widget"));
*status = 1;
}
...
...
@@ -227,7 +228,7 @@ Ge* WNavQt::ge_new(char* graph_name, int nojournal)
options |= ge_mOption_IgnoreJournal;
}
return new GeQt(NULL,
toplevel
, ldhses, 0, options, graph_name);
return new GeQt(NULL,
form_widget
, ldhses, 0, options, graph_name);
}
WGe* WNavQt::wge_new(char* name, char* filename, char* object_name, int modal)
...
...
@@ -458,14 +459,14 @@ void WNavQt::wge_modal_loop(WGe* wge)
void WNavQt::message_dialog(char* title, char* text)
{
QMessageBox::critical(
toplevel
->window(), translate_utf8(title), translate_utf8(text));
form_widget
->window(), translate_utf8(title), translate_utf8(text));
}
int WNavQt::confirm_dialog(
char* title, char* text, int display_cancel, int* cancel)
{
QMessageBox::StandardButton reply = QMessageBox::question(
toplevel
, translate_utf8(title), translate_utf8(text));
form_widget
, translate_utf8(title), translate_utf8(text));
if (reply == QMessageBox::Yes) {
return 1;
...
...
@@ -479,7 +480,7 @@ int WNavQt::continue_dialog(char* title, char* text)
{
// Create a question window
QMessageBox::StandardButton reply = QMessageBox::question(
toplevel
, fl(title), fl(text), QMessageBox::Ok | QMessageBox::Cancel);
form_widget
, fl(title), fl(text), QMessageBox::Ok | QMessageBox::Cancel);
if (reply == QMessageBox::Ok) {
return 1;
} else {
...
...
@@ -490,7 +491,7 @@ int WNavQt::continue_dialog(char* title, char* text)
int WNavQt::prompt_dialog(char* title, char* text, char** value)
{
bool ok;
QString str = QInputDialog::getText(
toplevel
, translate_utf8(title),
QString str = QInputDialog::getText(
form_widget
, translate_utf8(title),
translate_utf8(text), QLineEdit::Normal, "", &ok);
if (ok) {
strcpy(*value, qPrintableLatin1(str));
...
...
wb/lib/wb/qt/wb_wnav_qt.h
View file @
d1b52cf9
...
...
@@ -104,7 +104,6 @@ public:
WAttText
*
watttext_new
(
pwr_tAttrRef
aref
,
int
editmode
,
pwr_tStatus
*
status
);
private:
QWidget
*
toplevel
;
QWidget
*
parent_wid
;
WNavQtTraceObject
*
trace_obj
;
};
...
...
wb/lib/wb/qt/wb_wtt_qt.cqt
View file @
d1b52cf9
...
...
@@ -2016,7 +2016,7 @@ WttQt::WttQt(void* wt_parent_ctx, QWidget* wt_parent_wid, const char* wt_name,
menu_pasteinto_w = addMenuItem(
toplevel, edit, "Paste Into", SLOT(activate_pasteinto()), "CTRL+SHIFT+V");
menu_rename_w = addMenuItem(
toplevel, edit, "Rename", SLOT(
open_change_
name()), "CTRL+SHIFT+N");
toplevel, edit, "Rename", SLOT(
activate_re
name()), "CTRL+SHIFT+N");
// Functions menu
QMenu* functions = menu_bar->addMenu(translate_utf8("&Functions"));
...
...
xtt/exe/co_help/qt/co_help_qt.cpp
View file @
d1b52cf9
...
...
@@ -41,6 +41,7 @@
#include "co_help_qt.h"
#include "cow_qt_helpers.h"
#include "cow_style_qt.h"
#include "cow_xhelp_qt.h"
#include <QApplication>
...
...
@@ -57,6 +58,7 @@ int main(int argc, char* argv[])
int
sts
;
QApplication
app
(
argc
,
argv
);
QApplication
::
setStyle
(
new
PwrStyle
());
setlocale
(
LC_NUMERIC
,
"POSIX"
);
setlocale
(
LC_TIME
,
"en_US"
);
...
...
xtt/exe/pwr_rtmon/qt/pwr_rtmon_qt.cpp
View file @
d1b52cf9
...
...
@@ -41,6 +41,7 @@
#include "cow_qt_helpers.h"
#include "cow_rtmon_qt.h"
#include "cow_style_qt.h"
#include "cow_xhelp_qt.h"
#include <QApplication>
...
...
@@ -81,6 +82,7 @@ int main(int argc, char* argv[])
}
QApplication
app
(
argc
,
argv
);
QApplication
::
setStyle
(
new
PwrStyle
());
setlocale
(
LC_NUMERIC
,
"POSIX"
);
setlocale
(
LC_TIME
,
"en_US"
);
...
...
xtt/exe/rt_statusmon/qt/rt_statusmon_qt.cpp
View file @
d1b52cf9
...
...
@@ -41,6 +41,7 @@
#include "cow_msgwindow.h"
#include "cow_qt_helpers.h"
#include "cow_statusmon_nodelist_qt.h"
#include "cow_style_qt.h"
#include "cow_xhelp_qt.h"
#include <QApplication>
...
...
@@ -106,6 +107,7 @@ int main(int argc, char* argv[])
}
QApplication
app
(
argc
,
argv
);
QApplication
::
setStyle
(
new
PwrStyle
());
setlocale
(
LC_NUMERIC
,
"POSIX"
);
setlocale
(
LC_TIME
,
"en_US"
);
...
...
xtt/exe/rt_xtt/qt/rt_xtt_qt.cqt
View file @
d1b52cf9
...
...
@@ -41,6 +41,7 @@
#include "cow_login_qt.h"
#include "cow_qt_helpers.h"
#include "cow_style_qt.h"
#include "cow_xhelp_qt.h"
#include "xtt_hotkey_qt.h"
...
...
@@ -552,6 +553,7 @@ int main(int argc, char* argv[])
int sts;
QApplication app(argc, argv);
QApplication::setStyle(new PwrStyle());
new XttQt(argc, argv, &sts);
app.exec();
exit(sts);
...
...
xtt/exe/rt_xtt_cmd/qt/rt_xtt_cmd_qt.cpp
View file @
d1b52cf9
...
...
@@ -42,6 +42,7 @@
#include "co_dcli.h"
#include "cow_qt_helpers.h"
#include "cow_style_qt.h"
#include "xtt_xnav_qt.h"
...
...
@@ -124,6 +125,7 @@ int main(int argc, char* argv[])
}
QApplication
app
(
argc
,
argv
);
QApplication
::
setStyle
(
new
PwrStyle
());
setlocale
(
LC_TIME
,
"en_US"
);
setlocale
(
LC_NUMERIC
,
"POSIX"
);
...
...
xtt/exe/wb_ge/qt/wb_ge_qt.cpp
View file @
d1b52cf9
...
...
@@ -40,6 +40,7 @@
#include "cow_msgwindow_qt.h"
#include "cow_qt_helpers.h"
#include "cow_style_qt.h"
#include "cow_xhelp_qt.h"
#include "ge_qt.h"
...
...
@@ -71,6 +72,7 @@ int main(int argc, char* argv[])
pwr_tFileName
fname
;
QApplication
app
(
argc
,
argv
);
QApplication
::
setStyle
(
new
PwrStyle
());
setlocale
(
LC_NUMERIC
,
"POSIX"
);
setlocale
(
LC_TIME
,
"en_US"
);
...
...
xtt/lib/cow/qt/cow_style_qt.cqt
0 → 100644
View file @
d1b52cf9
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2017 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
**/
#include "cow_style_qt.h"
int PwrStyle::pixelMetric(PixelMetric which, const QStyleOption *option, const QWidget *widget) const
{
switch(which) {
case PM_LayoutLeftMargin:
case PM_LayoutTopMargin:
case PM_LayoutRightMargin:
case PM_LayoutBottomMargin:
return 0;
default:
return QGtkStyle::pixelMetric(which, option, widget);
}
}
xtt/lib/cow/qt/cow_style_qt.h
0 → 100644
View file @
d1b52cf9
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2017 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
**/
#ifndef cow_style_qt_h
#define cow_style_qt_h
#include <QGtkStyle>
class
PwrStyle
:
public
QGtkStyle
{
Q_OBJECT
public:
PwrStyle
()
:
QGtkStyle
()
{}
int
pixelMetric
(
PixelMetric
which
,
const
QStyleOption
*
option
,
const
QWidget
*
widget
=
0
)
const
;
};
#endif
\ No newline at end of file
xtt/lib/glow/qt/glow_draw_qt.cqt
View file @
d1b52cf9
...
...
@@ -388,25 +388,20 @@ int GlowDrawQt::event_handler(QEvent* event)
return 1;
}
QObject* parent = m_wind->window;
QObject* windowParent = m_wind->window;
QObject* navWindowParent = nav_wind->window;
bool windowEvent = false;
while (parent != NULL) {
if (QApplication::focusWidget() == parent) {
windowEvent = true;
break;
}
parent = parent->parent();
}
bool navWindowEvent = false;
if (
!windowEvent
) {
parent = nav_wind->window;
while (parent != NULL) {
if (QApplication::focusWidget() == parent) {
navWindowEvent = true;
if (
QApplication::focusWidget() != NULL
) {
while (!(windowParent == NULL && navWindowParent == NULL)) {
windowEvent = (QApplication::focusWidget() == windowParent);
navWindowEvent = (QApplication::focusWidget() == navWindowParent);
if (windowEvent || navWindowEvent) {
break;
}
parent = parent->parent();
windowParent = (windowParent == NULL) ? NULL : windowParent->parent();
navWindowParent
= (navWindowParent == NULL) ? NULL : navWindowParent->parent();
}
}
...
...
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