~ubuntu-branches/ubuntu/wily/psi/wily-proposed

« back to all changes in this revision

Viewing changes to src/widgets/psitabwidget.cpp

  • Committer: Package Import Robot
  • Author(s): Jan Niehusmann
  • Date: 2014-07-01 21:49:34 UTC
  • mfrom: (6.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20140701214934-gt4dkgm94byi4vnn
Tags: 0.15-1
* New upstream version
* set debhelper compat level to 9
* set Standards-Version to 3.9.5 (no further changes)
* add lintian override regarding license-problem-non-free-RFC
* use qconf to regenerate configure script
* implement hardening using buildflags instead of hardening-wrapper

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 *
15
15
 * You should have received a copy of the GNU General Public License
16
16
 * along with this library; if not, write to the Free Software
17
 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
18
 *
19
19
 */
20
20
 
21
21
#include "psitabwidget.h"
22
22
#include "psitabbar.h"
 
23
#include "common.h"
23
24
#include <QWidget>
24
25
#include <QVBoxLayout>
25
26
#include <QHBoxLayout>
56
57
        downButton_->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
57
58
        menu_ = new QMenu(this);
58
59
        downButton_->setMenu(menu_);
 
60
        downButton_->setStyleSheet(" QToolButton::menu-indicator { image:none } ");
59
61
        connect(menu_, SIGNAL(aboutToShow()), SLOT(menu_aboutToShow()));
60
62
        connect(menu_, SIGNAL(triggered(QAction*)), SLOT(menu_triggered(QAction*)));
61
63
        barLayout_->addWidget(downButton_);
73
75
        setTabPosition(QTabWidget::North);
74
76
 
75
77
        connect( tabBar_, SIGNAL(mouseDoubleClickTab(int)), SLOT(mouseDoubleClickTab(int)));
 
78
        connect( tabBar_, SIGNAL(mouseMiddleClickTab(int)), SLOT(mouseMiddleClickTab(int)));
76
79
        connect( tabBar_, SIGNAL( currentChanged(int)), SLOT(tab_currentChanged(int)));
77
80
        connect( tabBar_, SIGNAL( contextMenu(QContextMenuEvent*,int)), SLOT( tab_contextMenu(QContextMenuEvent*,int)));
78
81
        connect( closeButton_, SIGNAL(clicked()), SIGNAL(closeButtonClicked()));
115
118
        emit mouseDoubleClickTab(widget(tab));
116
119
}
117
120
 
 
121
void PsiTabWidget::mouseMiddleClickTab(int tab) {
 
122
        emit mouseMiddleClickTab(widget(tab));
 
123
}
 
124
 
118
125
/**
119
126
 * Number of tabs/widgets
120
127
 */
224
231
225
232
 
226
233
void PsiTabWidget::setCurrentPage(int index) {
227
 
        Q_ASSERT(index >=0 && index < count());
228
 
        showPage(widgets_[index]);
 
234
        if (index >= 0 && index < count()) {
 
235
                showPage(widgets_[index]);
 
236
        }
229
237
}
230
238
 
231
239
void PsiTabWidget::removeCurrentPage() {
256
264
}
257
265
 
258
266
void PsiTabWidget::menu_aboutToShow() {
259
 
        menu_->clear();
 
267
        clearMenu(menu_);
260
268
        bool vis = false;
261
269
        for (int i = 0; i < tabBar_->count(); i++) {
262
270
                QRect r = tabBar_->tabRect(i);