From: pavelpa Date: Tue, 26 Jan 2010 07:29:07 +0000 (+0000) Subject: new TabWidget - contains "info" icon/button to show "AboutApplication" dialog X-Git-Tag: 0.5.0~199 X-Git-Url: https://git.toastfreeware.priv.at/toast/confclerk.git/commitdiff_plain/cb18bc7c85b56de7f5a364cd2f995994604c169b new TabWidget - contains "info" icon/button to show "AboutApplication" dialog --- diff --git a/src/gui/mainwindow.ui b/src/gui/mainwindow.ui index a01b8ef..021d64e 100644 --- a/src/gui/mainwindow.ui +++ b/src/gui/mainwindow.ui @@ -21,7 +21,7 @@ - + 0 @@ -118,39 +118,39 @@ - - + + Search - + - - + + true - - + + 0 0 - + - - + + Search again - + S - + Qt::ToolButtonTextOnly - - + + 16777215 16777215 @@ -162,104 +162,104 @@ - + - - - + + + 0 0 - + 16777215 16777215 - - + + QLayout::SetDefaultConstraint - - + + - - + + true - + type a keyword to search - - + + Search - + false - + true - + true - + false - - + + - - + + Title - + true - - + + Abstract - - + + Speaker - - + + Tag - - + + Room - - + + Qt::Horizontal - + 40 20 @@ -273,39 +273,36 @@ - - - + + + 0 1 - + 0 0 - + 16777215 16777215 - - 100 - - - + + Qt::Vertical - + QSizePolicy::Expanding - + 20 1 @@ -533,6 +530,12 @@ QTreeView
../mvc/treeview.h
+ + TabWidget + QTabWidget +
tabwidget.h
+ 1 +
diff --git a/src/gui/tabwidget.cpp b/src/gui/tabwidget.cpp new file mode 100644 index 0000000..8fdfb72 --- /dev/null +++ b/src/gui/tabwidget.cpp @@ -0,0 +1,37 @@ +#include "tabwidget.h" + +#include +#include + +#include + +const int SPACER = 5; + +TabWidget::TabWidget(QWidget *aParent) + : QTabWidget(aParent) + , mPressPoint(0,0) +{ + mInfoImage = QImage(":/icons/info.png"); +} + +void TabWidget::paintEvent(QPaintEvent *event) +{ + QPainter painter(this); + painter.drawImage(rect().topRight()-QPoint(mInfoImage.width()+SPACER,-SPACER),mInfoImage); +} + +void TabWidget::mousePressEvent(QMouseEvent *event) +{ + mPressPoint = event->pos(); +} + +void TabWidget::mouseReleaseEvent(QMouseEvent *event) +{ + QPoint topLeft = rect().topRight()-QPoint(mInfoImage.width()+SPACER,-SPACER); + QRect infoRect = QRect(topLeft, topLeft+QPoint(mInfoImage.width(),mInfoImage.height())); + if( (infoRect.contains(event->pos())) && (infoRect.contains(mPressPoint)) ) + { + emit(infoIconClicked()); + } +} + diff --git a/src/gui/tabwidget.h b/src/gui/tabwidget.h new file mode 100644 index 0000000..6d73408 --- /dev/null +++ b/src/gui/tabwidget.h @@ -0,0 +1,24 @@ +#ifndef TABWIDGET_H +#define TABWIDGET_H + +#include + +class TabWidget : public QTabWidget +{ + Q_OBJECT +public: + TabWidget(QWidget *aParent = NULL); + ~TabWidget() {} +protected: + void paintEvent(QPaintEvent *event); + void mousePressEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); +signals: + void infoIconClicked(); +private: + QPoint mPressPoint; + QImage mInfoImage; +}; + +#endif /* TABWIDGET_H */ +