snippets: move search zone in button area. Fix shortcuts

This commit is contained in:
Jean-Francois Dockes 2012-10-30 07:44:53 +01:00
parent 09ff4ef393
commit 7da0307c25
2 changed files with 108 additions and 96 deletions

View file

@ -13,9 +13,9 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Snippets</string> <string>Snippets</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QWebView" name="browser"> <widget class="QWebView" name="browser">
<property name="url"> <property name="url">
@ -26,88 +26,104 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QFrame" name="searchFM"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="frameShape"> <item>
<enum>QFrame::StyledPanel</enum> <widget class="QFrame" name="searchFM">
</property> <property name="sizePolicy">
<property name="frameShadow"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<enum>QFrame::Raised</enum> <horstretch>1</horstretch>
</property> <verstretch>0</verstretch>
<layout class="QHBoxLayout" name="horizontalLayout"> </sizepolicy>
<item> </property>
<widget class="QToolButton" name="searchClosePB"> <property name="frameShape">
<property name="sizePolicy"> <enum>QFrame::StyledPanel</enum>
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> </property>
<horstretch>0</horstretch> <property name="frameShadow">
<verstretch>0</verstretch> <enum>QFrame::Raised</enum>
</sizepolicy> </property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="topMargin">
<number>1</number>
</property> </property>
<property name="text"> <property name="bottomMargin">
<string notr="true">X</string> <number>1</number>
</property> </property>
<property name="toolButtonStyle"> <item>
<enum>Qt::ToolButtonTextOnly</enum> <widget class="QToolButton" name="searchClosePB">
</property> <property name="sizePolicy">
</widget> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
</item> <horstretch>0</horstretch>
<item> <verstretch>0</verstretch>
<widget class="QLabel" name="searchLB"> </sizepolicy>
<property name="text"> </property>
<string>Find:</string> <property name="text">
</property> <string notr="true">X</string>
</widget> </property>
</item> <property name="toolButtonStyle">
<item> <enum>Qt::ToolButtonTextOnly</enum>
<widget class="QLineEdit" name="searchLE"> </property>
<property name="sizePolicy"> </widget>
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> </item>
<horstretch>0</horstretch> <item>
<verstretch>0</verstretch> <widget class="QLabel" name="searchLB">
</sizepolicy> <property name="text">
</property> <string>Find:</string>
</widget> </property>
</item> </widget>
<item> </item>
<widget class="QPushButton" name="nextPB"> <item>
<property name="sizePolicy"> <widget class="QLineEdit" name="searchLE">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <property name="sizePolicy">
<horstretch>0</horstretch> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<verstretch>0</verstretch> <horstretch>0</horstretch>
</sizepolicy> <verstretch>0</verstretch>
</property> </sizepolicy>
<property name="text"> </property>
<string>Next</string> </widget>
</property> </item>
</widget> <item>
</item> <widget class="QPushButton" name="nextPB">
<item> <property name="sizePolicy">
<widget class="QPushButton" name="prevPB"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<property name="sizePolicy"> <horstretch>0</horstretch>
<sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <verstretch>0</verstretch>
<horstretch>0</horstretch> </sizepolicy>
<verstretch>0</verstretch> </property>
</sizepolicy> <property name="text">
</property> <string>Next</string>
<property name="text"> </property>
<string>Prev</string> </widget>
</property> </item>
</widget> <item>
</item> <widget class="QPushButton" name="prevPB">
</layout> <property name="sizePolicy">
</widget> <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Prev</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<customwidgets> <customwidgets>
@ -119,22 +135,6 @@
</customwidgets> </customwidgets>
<resources/> <resources/>
<connections> <connections>
<connection>
<sender>buttonBox</sender>
<signal>clicked(QAbstractButton*)</signal>
<receiver>Snippets</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>257</x>
<y>369</y>
</hint>
<hint type="destinationlabel">
<x>257</x>
<y>197</y>
</hint>
</hints>
</connection>
<connection> <connection>
<sender>searchClosePB</sender> <sender>searchClosePB</sender>
<signal>clicked()</signal> <signal>clicked()</signal>

View file

@ -64,17 +64,29 @@ void SnippetsW::init()
if (m_source.isNull()) if (m_source.isNull())
return; return;
QPushButton *searchButton = new QPushButton(tr("Search"));
searchButton->setAutoDefault(false);
buttonBox->addButton(searchButton, QDialogButtonBox::ActionRole);
searchFM->hide(); searchFM->hide();
new QShortcut(QKeySequence::Find, this, SLOT(slotEditFind())); new QShortcut(QKeySequence::Find, this, SLOT(slotEditFind()));
new QShortcut(QKeySequence(Qt::Key_Slash), this, SLOT(slotEditFind())); new QShortcut(QKeySequence(Qt::Key_Slash), this, SLOT(slotEditFind()));
new QShortcut(QKeySequence(Qt::Key_Escape), searchFM, SLOT(hide()));
new QShortcut(QKeySequence::FindNext, this, SLOT(slotEditFindNext())); new QShortcut(QKeySequence::FindNext, this, SLOT(slotEditFindNext()));
new QShortcut(QKeySequence(Qt::Key_F3), this, SLOT(slotEditFindNext()));
new QShortcut(QKeySequence::FindPrevious, this, new QShortcut(QKeySequence::FindPrevious, this,
SLOT(slotEditFindPrevious())); SLOT(slotEditFindPrevious()));
new QShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F3),
this, SLOT(slotEditFindPrevious()));
QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close);
if (closeButton)
connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
connect(searchButton, SIGNAL(clicked()), this, SLOT(slotEditFind()));
connect(searchLE, SIGNAL(textChanged(const QString&)), connect(searchLE, SIGNAL(textChanged(const QString&)),
this, SLOT(slotSearchTextChanged(const QString&))); this, SLOT(slotSearchTextChanged(const QString&)));
connect(nextPB, SIGNAL(clicked()), this, SLOT(slotEditFindNext())); connect(nextPB, SIGNAL(clicked()), this, SLOT(slotEditFindNext()));
new QShortcut(QKeySequence(Qt::Key_F3), this, SLOT(slotEditFindNext()));
connect(prevPB, SIGNAL(clicked()), this, SLOT(slotEditFindPrevious())); connect(prevPB, SIGNAL(clicked()), this, SLOT(slotEditFindPrevious()));
#ifdef SNIPPETS_WEBKIT #ifdef SNIPPETS_WEBKIT