Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
flatpak-qt-creator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
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
Marco Bubke
flatpak-qt-creator
Commits
309ee636
Commit
309ee636
authored
Jul 14, 2009
by
con
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Styled two-row find tool bar with better resizing behavior.
For this we needed to get rid of using QToolBar.
parent
8234858b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
148 additions
and
74 deletions
+148
-74
src/plugins/coreplugin/manhattanstyle.cpp
src/plugins/coreplugin/manhattanstyle.cpp
+2
-0
src/plugins/find/findtoolbar.cpp
src/plugins/find/findtoolbar.cpp
+73
-17
src/plugins/find/findtoolbar.h
src/plugins/find/findtoolbar.h
+2
-2
src/plugins/find/findwidget.ui
src/plugins/find/findwidget.ui
+71
-55
No files found.
src/plugins/coreplugin/manhattanstyle.cpp
View file @
309ee636
...
...
@@ -86,6 +86,8 @@ bool panelWidget(const QWidget *widget)
return
true
;
else
if
(
qobject_cast
<
const
QMenuBar
*>
(
p
)
&&
styleEnabled
(
p
))
return
true
;
else
if
(
p
->
property
(
"panelwidget"
).
toBool
())
return
true
;
p
=
p
->
parentWidget
();
}
return
false
;
...
...
src/plugins/find/findtoolbar.cpp
View file @
309ee636
...
...
@@ -32,6 +32,7 @@
#include "textfindconstants.h"
#include <coreplugin/coreconstants.h>
#include <coreplugin/stylehelper.h>
#include <coreplugin/findplaceholder.h>
#include <coreplugin/icore.h>
#include <coreplugin/stylehelper.h>
...
...
@@ -49,9 +50,10 @@
#include <QtGui/QKeyEvent>
#include <QtGui/QLineEdit>
#include <QtGui/QMenu>
#include <QtGui/QPainter>
#include <QtGui/QPushButton>
#include <QtGui/QToolButton>
#include <QtGui/QPainter>
#include <QtGui/QPixmapCache>
Q_DECLARE_METATYPE
(
QStringList
)
Q_DECLARE_METATYPE
(
Find
::
IFindFilter
*
)
...
...
@@ -68,14 +70,13 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
m_findNextAction
(
0
),
m_findPreviousAction
(
0
),
m_replaceNextAction
(
0
),
m_widget
(
new
QWidget
),
m_casesensitiveIcon
(
":/find/images/casesensitively.png"
),
m_regexpIcon
(
":/find/images/regexp.png"
),
m_wholewordsIcon
(
":/find/images/wholewords.png"
)
{
//setup ui
m_ui
.
setupUi
(
m_widget
);
addWidget
(
m_widget
);
m_ui
.
setupUi
(
this
);
setProperty
(
"panelwidget"
,
true
);
setFocusProxy
(
m_ui
.
findEdit
);
setProperty
(
"topBorder"
,
true
);
m_ui
.
findEdit
->
setAttribute
(
Qt
::
WA_MacShowFocusRect
,
false
);
...
...
@@ -83,14 +84,9 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
connect
(
m_ui
.
findEdit
,
SIGNAL
(
editingFinished
()),
this
,
SLOT
(
invokeResetIncrementalSearch
()));
QWidget
*
spacerItem
=
new
QWidget
;
spacerItem
->
setSizePolicy
(
QSizePolicy
::
Expanding
,
QSizePolicy
::
Minimum
);
addWidget
(
spacerItem
);
QToolButton
*
close
=
new
QToolButton
;
close
->
setProperty
(
"type"
,
QLatin1String
(
"dockbutton"
));
close
->
setIcon
(
QIcon
(
":/core/images/closebutton.png"
));
connect
(
close
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
hideAndResetFocus
()));
addWidget
(
close
);
m_ui
.
close
->
setProperty
(
"type"
,
QLatin1String
(
"dockbutton"
));
m_ui
.
close
->
setIcon
(
QIcon
(
":/core/images/closebutton.png"
));
connect
(
m_ui
.
close
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
hideAndResetFocus
()));
m_ui
.
findPreviousButton
->
setProperty
(
"type"
,
QLatin1String
(
"dockbutton"
));
m_ui
.
findNextButton
->
setProperty
(
"type"
,
QLatin1String
(
"dockbutton"
));
...
...
@@ -110,7 +106,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
m_ui
.
findEdit
->
installEventFilter
(
this
);
m_ui
.
replaceEdit
->
installEventFilter
(
this
);
m_widget
->
installEventFilter
(
this
);
this
->
installEventFilter
(
this
);
connect
(
m_ui
.
findEdit
,
SIGNAL
(
textChanged
(
const
QString
&
)),
this
,
SLOT
(
invokeFindIncremental
()));
connect
(
m_ui
.
findEdit
,
SIGNAL
(
returnPressed
()),
this
,
SLOT
(
invokeFindEnter
()));
...
...
@@ -234,6 +230,56 @@ FindToolBar::~FindToolBar()
{
}
void
FindToolBar
::
paintEvent
(
QPaintEvent
*
event
)
{
// Currently from the style
// Goal should be to migrate that into a Utils::StyledWidget class
Q_UNUSED
(
event
)
QPainter
painter
(
this
);
QRect
selfRect
=
rect
();
QString
key
;
key
.
sprintf
(
"mh_toolbar %d %d %d"
,
selfRect
.
width
(),
selfRect
.
height
(),
StyleHelper
::
baseColor
().
rgb
());;
QPixmap
pixmap
;
QPainter
*
p
=
&
painter
;
if
(
StyleHelper
::
usePixmapCache
()
&&
!
QPixmapCache
::
find
(
key
,
pixmap
))
{
pixmap
=
QPixmap
(
selfRect
.
size
());
p
=
new
QPainter
(
&
pixmap
);
selfRect
=
QRect
(
0
,
0
,
selfRect
.
width
(),
selfRect
.
height
());
}
// Map offset for global window gradient
QPoint
offset
=
window
()
->
mapToGlobal
(
selfRect
.
topLeft
())
-
mapToGlobal
(
selfRect
.
topLeft
());
QRect
gradientSpan
;
gradientSpan
=
QRect
(
offset
,
window
()
->
size
());
StyleHelper
::
horizontalGradient
(
p
,
gradientSpan
,
selfRect
);
p
->
setPen
(
StyleHelper
::
borderColor
());
// Note: This is a hack to determine if the
// toolbar should draw the top or bottom outline
// (needed for the find toolbar for instance)
QColor
lighter
(
255
,
255
,
255
,
40
);
if
(
property
(
"topBorder"
).
toBool
())
{
p
->
drawLine
(
selfRect
.
topLeft
(),
selfRect
.
topRight
());
p
->
setPen
(
lighter
);
p
->
drawLine
(
selfRect
.
topLeft
()
+
QPoint
(
0
,
1
),
selfRect
.
topRight
()
+
QPoint
(
0
,
1
));
}
else
{
p
->
drawLine
(
selfRect
.
bottomLeft
(),
selfRect
.
bottomRight
());
p
->
setPen
(
lighter
);
p
->
drawLine
(
selfRect
.
topLeft
(),
selfRect
.
topRight
());
}
if
(
StyleHelper
::
usePixmapCache
()
&&
!
QPixmapCache
::
find
(
key
,
pixmap
))
{
painter
.
drawPixmap
(
selfRect
.
topLeft
(),
pixmap
);
p
->
end
();
delete
p
;
QPixmapCache
::
insert
(
key
,
pixmap
);
}
}
bool
FindToolBar
::
eventFilter
(
QObject
*
obj
,
QEvent
*
event
)
{
if
((
obj
==
m_ui
.
findEdit
||
obj
==
m_findCompleter
->
popup
())
...
...
@@ -251,7 +297,7 @@ bool FindToolBar::eventFilter(QObject *obj, QEvent *event)
return
true
;
}
}
}
else
if
(
obj
==
m_widget
&&
event
->
type
()
==
QEvent
::
ShortcutOverride
)
{
}
else
if
(
obj
==
this
&&
event
->
type
()
==
QEvent
::
ShortcutOverride
)
{
QKeyEvent
*
ke
=
static_cast
<
QKeyEvent
*>
(
event
);
if
(
ke
->
key
()
==
Qt
::
Key_Escape
&&
!
ke
->
modifiers
()
&&
!
m_findCompleter
->
popup
()
->
isVisible
()
...
...
@@ -268,13 +314,13 @@ bool FindToolBar::eventFilter(QObject *obj, QEvent *event)
event
->
accept
();
return
true
;
}
}
else
if
(
obj
==
m_widget
&&
event
->
type
()
==
QEvent
::
Hide
)
{
}
else
if
(
obj
==
this
&&
event
->
type
()
==
QEvent
::
Hide
)
{
invokeClearResults
();
if
(
m_currentDocumentFind
->
isEnabled
())
{
m_currentDocumentFind
->
clearFindScope
();
}
}
return
Q
ToolBar
::
eventFilter
(
obj
,
event
);
return
Q
Widget
::
eventFilter
(
obj
,
event
);
}
void
FindToolBar
::
updateActions
()
...
...
@@ -284,9 +330,11 @@ void FindToolBar::updateActions()
m_findInDocumentAction
->
setEnabled
(
enabled
);
m_findNextAction
->
setEnabled
(
enabled
);
m_findPreviousAction
->
setEnabled
(
enabled
);
m_replaceNextAction
->
setEnabled
(
replaceEnabled
);
m_replacePreviousAction
->
setEnabled
(
replaceEnabled
);
m_replaceAllAction
->
setEnabled
(
replaceEnabled
);
m_caseSensitiveAction
->
setEnabled
(
enabled
);
m_wholeWordAction
->
setEnabled
(
enabled
);
m_regularExpressionAction
->
setEnabled
(
enabled
);
...
...
@@ -295,8 +343,16 @@ void FindToolBar::updateActions()
bool
replaceFocus
=
m_ui
.
replaceEdit
->
hasFocus
();
m_ui
.
findEdit
->
setEnabled
(
enabled
);
m_ui
.
findLabel
->
setEnabled
(
enabled
);
m_ui
.
replaceEdit
->
setEnabled
(
replaceEnabled
);
m_ui
.
replaceLabel
->
setEnabled
(
replaceEnabled
);
m_ui
.
replaceEdit
->
setVisible
(
replaceEnabled
);
m_ui
.
replaceLabel
->
setVisible
(
replaceEnabled
);
m_ui
.
replacePreviousButton
->
setVisible
(
replaceEnabled
);
m_ui
.
replaceNextButton
->
setVisible
(
replaceEnabled
);
m_ui
.
replaceAllButton
->
setVisible
(
replaceEnabled
);
layout
()
->
invalidate
();
if
(
!
replaceEnabled
&&
enabled
&&
replaceFocus
)
m_ui
.
findEdit
->
setFocus
();
updateIcons
();
...
...
@@ -540,7 +596,7 @@ bool FindToolBar::focusNextPrevChild(bool next)
else
if
(
!
next
&&
m_ui
.
findEdit
->
hasFocus
())
m_ui
.
replaceAllButton
->
setFocus
(
Qt
::
TabFocusReason
);
else
return
Q
ToolBar
::
focusNextPrevChild
(
next
);
return
Q
Widget
::
focusNextPrevChild
(
next
);
return
true
;
}
...
...
src/plugins/find/findtoolbar.h
View file @
309ee636
...
...
@@ -44,13 +44,14 @@ namespace Internal {
class
FindPlugin
;
class
FindToolBar
:
public
Q
ToolBar
class
FindToolBar
:
public
Q
Widget
{
Q_OBJECT
public:
FindToolBar
(
FindPlugin
*
plugin
,
CurrentDocumentFind
*
currentDocumentFind
);
~
FindToolBar
();
void
paintEvent
(
QPaintEvent
*
event
);
void
readSettings
();
void
writeSettings
();
...
...
@@ -113,7 +114,6 @@ private:
QAction
*
m_caseSensitiveAction
;
QAction
*
m_wholeWordAction
;
QAction
*
m_regularExpressionAction
;
QWidget
*
m_widget
;
IFindSupport
::
FindFlags
m_findFlags
;
QPixmap
m_casesensitiveIcon
;
...
...
src/plugins/find/findwidget.ui
View file @
309ee636
...
...
@@ -6,57 +6,47 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
60
0
</width>
<height>
71
</height>
<width>
60
3
</width>
<height>
90
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Find
</string>
</property>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_3"
>
<property
name=
"spacing"
>
<number>
15
</number>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<property
name=
"leftMargin"
>
<number>
5
</number>
</property>
<property
name=
"topMargin"
>
<number>
1
</number>
<number>
2
</number>
</property>
<property
name=
"rightMargin"
>
<number>
5
</number>
<number>
0
</number>
</property>
<property
name=
"bottomMargin"
>
<number>
1
</number>
</property>
<item>
<property
name=
"horizontalSpacing"
>
<number>
5
</number>
</property>
<property
name=
"verticalSpacing"
>
<number>
0
</number>
</property>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"findLabel"
>
<property
name=
"text"
>
<string>
Find:
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"1"
>
<widget
class=
"Core::Utils::FancyLineEdit"
name=
"findEdit"
/>
</item>
<item
row=
"0"
column=
"2"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
<property
name=
"spacing"
>
<number>
2
</number>
<number>
3
</number>
</property>
<item>
<widget
class=
"QLabel"
name=
"findLabel"
>
<property
name=
"text"
>
<string>
Find:
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"Core::Utils::FancyLineEdit"
name=
"findEdit"
>
<property
name=
"minimumSize"
>
<size>
<width>
160
</width>
<height>
0
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
160
</width>
<height>
16777215
</height>
</size>
</property>
</widget>
</item>
<item>
<widget
class=
"QToolButton"
name=
"findPreviousButton"
>
<property
name=
"focusPolicy"
>
...
...
@@ -80,36 +70,43 @@
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
<property
name=
"spacing"
>
<number>
2
</number>
</property>
<item>
<
widget
class=
"QLabel"
name=
"replaceLabel
"
>
<property
name=
"
text
"
>
<
string>
Replace with:
</string
>
<
spacer
name=
"horizontalSpacer
"
>
<property
name=
"
orientation
"
>
<
enum>
Qt::Horizontal
</enum
>
</property>
</widget>
</item>
<item>
<widget
class=
"QLineEdit"
name=
"replaceEdit"
>
<property
name=
"minimumSize"
>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
15
0
</width>
<height>
0
</height>
<width>
4
0
</width>
<height>
2
0
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
150
</width>
<height>
16777215
</height>
</size>
</spacer>
</item>
<item>
<widget
class=
"QToolButton"
name=
"close"
>
<property
name=
"text"
>
<string>
...
</string>
</property>
</widget>
</item>
</layout>
</item>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QLabel"
name=
"replaceLabel"
>
<property
name=
"text"
>
<string>
Replace with:
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"replaceEdit"
/>
</item>
<item
row=
"1"
column=
"2"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
<property
name=
"spacing"
>
<number>
3
</number>
</property>
<item>
<widget
class=
"QToolButton"
name=
"replacePreviousButton"
>
<property
name=
"focusPolicy"
>
...
...
@@ -146,6 +143,19 @@
</property>
</widget>
</item>
<item>
<spacer
name=
"replaceSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
0
</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
...
...
@@ -157,6 +167,12 @@
<header
location=
"global"
>
utils/fancylineedit.h
</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>
findEdit
</tabstop>
<tabstop>
replaceEdit
</tabstop>
<tabstop>
close
</tabstop>
<tabstop>
replaceAllButton
</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
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