Permalink
Browse files

Fixed - minor UI annoyances; Replaced menu by buttons in floating wid…

…get toolbar (need icons)
  • Loading branch information...
1 parent fc490e4 commit 4e2d1aa9a461cae085f65a20078fcb59c28eb3be Pierre Marchand committed Feb 17, 2011
@@ -21,6 +21,9 @@
#include "filtersdialogitem.h"
#include "ui_filtersdialogitem.h"
+
+#include <QMessageBox>
+
FiltersDialogItem::FiltersDialogItem(const QString& name, const QString& f, QWidget *parent) :
QWidget(parent),
ui(new Ui::FiltersDialogItem),
@@ -59,7 +62,8 @@ void FiltersDialogItem::slotFilter()
void FiltersDialogItem::slotRemove()
{
- emit Remove(filterName);
+ if(QMessageBox::question(0, tr("Remove Filter"), tr("Confirm deletion of filter:") + filterName, QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok) == QMessageBox::Ok)
+ emit Remove(filterName);
}
void FiltersDialogItem::setButtonsVisible(bool v)
View
@@ -30,7 +30,7 @@
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
- <number>6</number>
+ <number>0</number>
</property>
<property name="topMargin">
<number>2</number>
@@ -49,9 +49,15 @@
</property>
<item row="0" column="0">
<widget class="QLabel" name="filterName">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="maximumSize">
<size>
- <width>64</width>
+ <width>1000</width>
<height>24</height>
</size>
</property>
@@ -68,22 +74,12 @@
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
</widget>
</item>
<item row="0" column="1">
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>160</width>
- <height>24</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="0" column="2">
<widget class="QToolButton" name="filterButton">
<property name="maximumSize">
<size>
@@ -103,7 +99,7 @@
</property>
</widget>
</item>
- <item row="0" column="3">
+ <item row="0" column="2">
<widget class="QToolButton" name="removeButton">
<property name="maximumSize">
<size>
@@ -34,9 +34,11 @@ FloatingWidgetToolBar::FloatingWidgetToolBar(QWidget *parent) :
{
ui->setupUi(this);
- menu = new QMenu(this);
- setupMenu();
- ui->toolButton->setMenu(menu);
+ connect(ui->closeButton, SIGNAL(clicked()), this, SIGNAL(Close()));
+ connect(ui->hideButton, SIGNAL(clicked()), this, SIGNAL(Hide()));
+ connect(ui->printButton, SIGNAL(clicked()), this, SIGNAL(Print()));
+ connect(ui->detachButton, SIGNAL(clicked()), this, SLOT(setDetached()));
+ setupMenu();
}
@@ -60,31 +62,22 @@ void FloatingWidgetToolBar::changeEvent(QEvent *e)
void FloatingWidgetToolBar::setupMenu()
{
- menu->clear();
-
if(isDetached)
{
if(!noClose)
- {
- closeAction = new QAction(tr("Close"), menu);
- menu->addAction(closeAction);
- connect(closeAction, SIGNAL(triggered()), this, SIGNAL(Close()));
- }
- hideAction = new QAction(tr("Hide"), menu);
- menu->addAction(hideAction);
- connect(hideAction, SIGNAL(triggered()), this, SIGNAL(Hide()));
+ ui->closeButton->show();
+ else
+ ui->closeButton->hide();
+ ui->hideButton->show();
+ ui->detachButton->hide();
}
- printAction = new QAction(tr("Print"), menu);
- menu->addAction(printAction);
- connect(printAction, SIGNAL(triggered()), this, SIGNAL(Print()));
- if(!isDetached)
+ else
{
- detachAction = new QAction(tr("Detach"), menu);
- menu->addAction(detachAction);
- connect(detachAction, SIGNAL(triggered()), this, SLOT(setDetached()));
+ ui->closeButton->hide();
+ ui->hideButton->hide();
+ ui->detachButton->show();
}
-
-
+ ui->printButton->show();
}
void FloatingWidgetToolBar::setDetached()
@@ -46,12 +46,6 @@ class FloatingWidgetToolBar : public QWidget
private:
Ui::FloatingWidgetToolBar *ui;
- QAction * closeAction;
- QAction * hideAction;
- QAction * printAction;
- QAction * detachAction;
-
- QMenu * menu;
bool noClose;
bool isDetached;
@@ -41,43 +41,13 @@
<number>0</number>
</property>
<layout class="QGridLayout" name="gridLayout">
- <property name="leftMargin">
- <number>4</number>
- </property>
- <property name="topMargin">
+ <property name="horizontalSpacing">
<number>0</number>
</property>
- <property name="rightMargin">
- <number>4</number>
- </property>
- <property name="bottomMargin">
- <number>2</number>
+ <property name="margin">
+ <number>0</number>
</property>
<item row="0" column="0">
- <widget class="QToolButton" name="toolButton">
- <property name="font">
- <font>
- <pointsize>8</pointsize>
- </font>
- </property>
- <property name="text">
- <string>Actions</string>
- </property>
- <property name="popupMode">
- <enum>QToolButton::InstantPopup</enum>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonIconOnly</enum>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- <property name="arrowType">
- <enum>Qt::NoArrow</enum>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -90,11 +60,66 @@
</property>
</spacer>
</item>
+ <item row="0" column="1">
+ <widget class="QToolButton" name="printButton">
+ <property name="toolTip">
+ <string>Print</string>
+ </property>
+ <property name="text">
+ <string>P</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QToolButton" name="detachButton">
+ <property name="toolTip">
+ <string>Detach from main window</string>
+ </property>
+ <property name="text">
+ <string>D</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="4">
+ <widget class="QToolButton" name="closeButton">
+ <property name="maximumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="cursor">
+ <cursorShape>ArrowCursor</cursorShape>
+ </property>
+ <property name="toolTip">
+ <string>Close window</string>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ <property name="icon">
+ <iconset resource="application.qrc">
+ <normaloff>:/graphic-resources/filter-remove.png</normaloff>:/graphic-resources/filter-remove.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="3">
+ <widget class="QToolButton" name="hideButton">
+ <property name="toolTip">
+ <string>Hide window</string>
+ </property>
+ <property name="text">
+ <string>H</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
</layout>
</widget>
- <resources/>
+ <resources>
+ <include location="application.qrc"/>
+ </resources>
<connections/>
</ui>
View
@@ -69,7 +69,7 @@ PanoseWidget::PanoseWidget(QWidget *parent) :
QTreeWidgetItem * item(new QTreeWidgetItem(pItem));
item->setText(0, p[k][v]);
item->setData(0,Qt::UserRole,v);
- item->setForeground(0, QColor(qrand() % 255, qrand() % 255, qrand() % 255));
+// item->setForeground(0, QColor(qrand() % 255, qrand() % 255, qrand() % 255));
if(QFile::exists(fn2))
item->setIcon(0, QIcon(fn2));
}

0 comments on commit 4e2d1aa

Please sign in to comment.