29 #if defined (HAVE_CONFIG_H)
59 #if defined (HAVE_QTABWIDGET_SETMOVABLE)
66 #if defined (HAVE_QTABWIDGET_SETMOVABLE)
78 int old_pos = currentIndex ();
79 int new_pos = currentIndex () + direction;
81 if (new_pos < 0 || new_pos >= tabs)
82 new_pos = new_pos - direction*tabs;
86 #if defined (HAVE_QTABWIDGET_SETMOVABLE)
87 moveTab (old_pos, new_pos);
88 setCurrentIndex (old_pos);
89 setCurrentIndex (new_pos);
93 setCurrentIndex (new_pos);
98 QString current_title = tabText (currentIndex ());
99 int tab_with_focus = 0;
102 QStringList tab_texts;
104 for (
int i = 0; i < count (); i++)
105 tab_texts.append (tabText (i));
110 for (
int title = 0; title < tab_texts.count (); title++)
115 for (
int tab = title; tab < count (); tab++)
117 if (tabText (tab) == tab_texts.at (title))
120 moveTab (tab, title);
122 if (tab_texts.at (title) == current_title)
123 tab_with_focus = title;
130 setCurrentIndex (tab_with_focus);
137 int clicked_idx = -1;
140 for (
int i = 0; i < count (); i++)
142 click_pos = mapToGlobal (me->pos ());
143 if (tabRect (i).contains (mapFromGlobal (click_pos)))
151 if (clicked_idx >= 0)
153 int current_idx = currentIndex ();
154 int current_count = count ();
157 if ((me->type () == QEvent::MouseButtonDblClick
158 && me->button() == Qt::LeftButton)
159 || (me->type () != QEvent::MouseButtonDblClick
160 && me->button() == Qt::MidButton))
164 setCurrentIndex (clicked_idx);
168 if (current_idx - clicked_idx > 0)
169 setCurrentIndex (current_idx - 1);
170 else if (current_idx - clicked_idx < 0)
171 setCurrentIndex (current_idx);
173 else if (me->type () != QEvent::MouseButtonDblClick
174 && me->button() == Qt::RightButton)
177 setCurrentIndex (clicked_idx);
181 setCurrentIndex (current_idx);
183 else if (count () < current_count)
190 int new_idx = count () - 1;
193 if (current_idx - clicked_idx > 0)
194 new_idx = current_idx - 1;
195 else if (current_idx - clicked_idx < 0)
196 new_idx = current_idx;
199 setCurrentIndex (new_idx);
205 QTabBar::mousePressEvent (me);
211 QTabBar::mousePressEvent (me);
void close_current_tab_signal(bool)
void mousePressEvent(QMouseEvent *event)
void switch_left_tab(void)
void switch_tab(int direction, bool movetab=false)
void sort_tabs_alph(void)
void switch_right_tab(void)
void move_tab_right(void)