Changeset 6082 for trunk/qt4-gui/src/widgets
- Timestamp:
- 03/03/08 04:41:37 (9 months ago)
- Location:
- trunk/qt4-gui/src/widgets
- Files:
-
- 2 modified
-
tabwidget.cpp (modified) (5 diffs)
-
tabwidget.h (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/qt4-gui/src/widgets/tabwidget.cpp
r5892 r6082 18 18 */ 19 19 20 #include "config.h" 21 20 22 #include "tabwidget.h" 21 23 22 #include <QWheelEvent> 24 #ifdef USE_KDE 25 # include <QTabBar> 26 #else 27 # include <QWheelEvent> 28 #endif 23 29 24 30 using namespace LicqQtGui; 25 31 32 #ifndef USE_KDE 26 33 TabBar::TabBar(QWidget* parent) 27 34 : QTabBar(parent) … … 78 85 int t = tabAt(e->pos()); 79 86 if (t > -1 && t == myClickedTab) 80 emit m iddleClick(t);87 emit mouseMiddleClick(t); 81 88 } 82 89 … … 84 91 QTabBar::mouseReleaseEvent(e); 85 92 } 93 #endif 86 94 87 95 88 96 TabWidget::TabWidget(QWidget* parent) 89 : QTabWidget(parent)97 : TABWIDGET_BASE(parent) 90 98 { 99 #ifndef USE_KDE 91 100 TabBar* tb = new TabBar(this); 92 101 setTabBar(tb); 93 connect(tb, SIGNAL(middleClick(int)), SLOT(slot_middleClick(int))); 102 connect(tb, SIGNAL(mouseMiddleClick(int)), SLOT(slot_middleClick(int))); 103 #endif 94 104 } 95 105 … … 98 108 int index = indexOf(tab); 99 109 if (index != -1) 110 #ifdef USE_KDE 111 setTabTextColor(index, color); 112 #else 100 113 tabBar()->setTabTextColor(index, color); 114 #endif 101 115 } 102 116 103 117 void TabWidget::setPreviousPage() 104 118 { 105 dynamic_cast<TabBar*>(tabBar())->setPreviousTab(); 119 int index = tabBar()->currentIndex() - 1; 120 if (index < 0) 121 index = tabBar()->count() - 1; 122 123 tabBar()->setCurrentIndex(index); 106 124 } 107 125 108 126 void TabWidget::setNextPage() 109 127 { 110 dynamic_cast<TabBar*>(tabBar())->setNextTab(); 128 int index = tabBar()->currentIndex() + 1; 129 if (index >= tabBar()->count()) 130 index = 0; 131 132 tabBar()->setCurrentIndex(index); 111 133 } 112 134 135 #ifndef USE_KDE 113 136 void TabWidget::wheelEvent(QWheelEvent* e) 114 137 { … … 140 163 QWidget* p = widget(t); 141 164 if (p) 142 emit m iddleClick(p);165 emit mouseMiddleClick(p); 143 166 } 167 #endif -
trunk/qt4-gui/src/widgets/tabwidget.h
r5837 r6082 21 21 #define TABWIDGET_H 22 22 23 #include <QTabBar> 24 #include <QTabWidget> 23 #include "config.h" 24 25 #ifdef USE_KDE 26 # include <KDE/KTabWidget> 27 # define TABWIDGET_BASE KTabWidget 28 #else 29 # include <QTabBar> 30 # include <QTabWidget> 31 # define TABWIDGET_BASE QTabWidget 32 #endif 25 33 26 34 namespace LicqQtGui 27 35 { 28 36 37 #ifndef USE_KDE 29 38 class TabBar : public QTabBar 30 39 { … … 38 47 39 48 signals: 40 void m iddleClick(int t);49 void mouseMiddleClick(int t); 41 50 42 51 private: … … 47 56 int myClickedTab; 48 57 }; 58 #endif 49 59 50 60 51 class TabWidget : public QTabWidget61 class TabWidget : public TABWIDGET_BASE 52 62 { 53 63 Q_OBJECT … … 60 70 void setNextPage(); 61 71 72 #ifndef USE_KDE 62 73 signals: 63 void m iddleClick(QWidget* p);74 void mouseMiddleClick(QWidget* p); 64 75 65 76 private slots: … … 68 79 private: 69 80 virtual void wheelEvent(QWheelEvent* e); 81 #endif 70 82 }; 71 83
