Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ArmarXGui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software
ArmarX
ArmarXGui
Commits
5f024b7d
Commit
5f024b7d
authored
2 years ago
by
Rainer Kartmann
Browse files
Options
Downloads
Patches
Plain Diff
Show Labels next to favourtie widget icons in toolbar
parent
7ad3498c
No related branches found
No related tags found
1 merge request
!71
Show labels next to favourite widget icons in toolbr
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
source/ArmarXGui/applications/ArmarXGui/ArmarXMainWindow.cpp
+26
-8
26 additions, 8 deletions
source/ArmarXGui/applications/ArmarXGui/ArmarXMainWindow.cpp
source/ArmarXGui/applications/ArmarXGui/ArmarXMainWindow.h
+1
-1
1 addition, 1 deletion
source/ArmarXGui/applications/ArmarXGui/ArmarXMainWindow.h
with
27 additions
and
9 deletions
source/ArmarXGui/applications/ArmarXGui/ArmarXMainWindow.cpp
+
26
−
8
View file @
5f024b7d
...
...
@@ -331,17 +331,33 @@ namespace armarx
updateAvailableWidgetList
();
}
QAction
*
ArmarXMainWindow
::
addActionToToolBar
(
QAction
*
action
)
QAction
*
ArmarXMainWindow
::
addActionToToolBar
(
QAction
*
action
,
bool
allowText
)
{
QToolButton
*
button
=
new
QToolButton
(
ui
->
toolBar
);
if
(
!
action
->
icon
().
isNull
())
std
::
optional
<
QSize
>
textSize
;
if
(
allowText
)
{
const
auto
sz
=
action
->
icon
().
actualSize
({
256
,
24
});
button
->
setIcon
(
action
->
icon
());
button
->
setFixedSize
(
sz
);
button
->
setIconSize
(
sz
);
button
->
setToolButtonStyle
(
Qt
::
ToolButtonStyle
::
ToolButtonTextBesideIcon
);
button
->
setSizePolicy
(
QSizePolicy
::
Maximum
,
QSizePolicy
::
Fixed
);
// Get the width of the button when just showing text.
button
->
setText
(
action
->
text
());
textSize
=
button
->
sizeHint
();
}
button
->
setDefaultAction
(
action
);
if
(
not
action
->
icon
().
isNull
())
{
const
QSize
maxSize
{
256
,
24
};
const
QSize
iconSize
=
action
->
icon
().
actualSize
(
maxSize
);
// Setting the action has already set the icon, so this line is unnecessary.
// button->setIcon(action->icon());
button
->
setIconSize
(
iconSize
);
button
->
setFixedSize
(
textSize
.
has_value
()
?
QSize
{
textSize
->
width
()
+
iconSize
.
width
(),
iconSize
.
height
()}
:
iconSize
);
}
return
ui
->
toolBar
->
addWidget
(
button
);
}
...
...
@@ -1193,7 +1209,8 @@ namespace armarx
if
(
mainWidgets
.
contains
(
fullWidgetName
))
{
addActionToToolBar
(
action
);
bool
allowText
=
false
;
addActionToToolBar
(
action
,
allowText
);
}
actionList
[
fullWidgetName
]
=
action
;
connect
(
action
,
SIGNAL
(
triggered
()),
action
,
SLOT
(
addArmarXWidget
()),
Qt
::
UniqueConnection
);
...
...
@@ -1640,7 +1657,8 @@ namespace armarx
{
if
(
actionList
.
contains
(
widgetName
))
{
favoriteActions
.
emplace_back
(
addActionToToolBar
(
actionList
[
widgetName
]));
bool
allowText
=
true
;
favoriteActions
.
emplace_back
(
addActionToToolBar
(
actionList
[
widgetName
],
allowText
));
}
}
}
...
...
This diff is collapsed.
Click to expand it.
source/ArmarXGui/applications/ArmarXGui/ArmarXMainWindow.h
+
1
−
1
View file @
5f024b7d
...
...
@@ -200,7 +200,7 @@ namespace armarx
void
loadPlugins
(
const
QSet
<
QString
>&
pluginDirs
,
bool
searchRecursive
=
true
);
void
loadPlugins
(
const
QStringList
&
fileNames
);
QAction
*
addActionToToolBar
(
QAction
*
action
);
QAction
*
addActionToToolBar
(
QAction
*
action
,
bool
allowText
);
PluginCache
pluginCache
;
QDir
pluginsDir
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment