Version: 9.16.0
QtxToolButton.h
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, OPEN CASCADE
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#ifndef QTXTOOLBUTTON_H
21#define QTXTOOLBUTTON_H
22
23#include "Qtx.h"
24
25#include <QStringList>
26#include <QToolButton>
27#include <QVariant>
28
30{
31 Q_OBJECT
32
33 enum Move { NoMove=0, MoveUp, MoveDown, MoveFirst, MoveLast };
34
35public:
36 QtxToolButton( QWidget* = 0 );
37 virtual ~QtxToolButton();
38
39 int addItem( const QString&, const QVariant& = QVariant() );
40 int addItem( const QIcon&, const QString&, const QVariant& = QVariant() );
41 void addItems( const QStringList& );
42
43 int addSeparator( const QString& = QString() );
44 int addSeparator( const QIcon&, const QString& );
45
46 void removeItem( int );
47
48 int count() const;
49
50 QVariant currentData() const;
51 int currentIndex() const;
52 QString currentText() const;
53
54 QVariant itemData( int ) const;
55 QIcon itemIcon( int ) const;
56 QString itemText( int ) const;
57
58 void setItemData( int, const QVariant& );
59 void setItemIcon( int, const QIcon& );
60 void setItemText( int, const QString& );
61
62 int findText( const QString& );
63
64public slots:
65 void clear();
66
67 void setCurrentIndex( int );
68 void setCurrentText( const QString& );
69
70protected:
71 void keyPressEvent( QKeyEvent* );
72 void wheelEvent( QWheelEvent* );
73
74signals:
75 void activated( int );
76 void activated( const QString& );
78 void currentIndexChanged( const QString& );
79 void currentTextChanged( const QString& );
80
81private slots:
82 void actionTriggered( QAction* );
83
84private:
85 void internalUpdate();
86 QAction* actionAt( int ) const;
87 void moveIndex( Move );
88 void emitCurrentChanged( bool, bool );
89};
90
91#endif // QTXTOOLBUTTON_H
#define QTX_EXPORT
Definition: Qtx.h:36
Drop-down tool button that behaves like a drop-down combo-box.
Definition: QtxToolButton.h:30
void activated(int)
void currentIndexChanged(int)
void currentTextChanged(const QString &)
void activated(const QString &)
Move
Definition: QtxToolButton.h:33
void currentIndexChanged(const QString &)