Version: 9.16.0
QtxMRUAction.h
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, OPEN CASCADE
2//
3// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5//
6// This library is free software; you can redistribute it and/or
7// modify it under the terms of the GNU Lesser General Public
8// License as published by the Free Software Foundation; either
9// version 2.1 of the License, or (at your option) any later version.
10//
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// Lesser General Public License for more details.
15//
16// You should have received a copy of the GNU Lesser General Public
17// License along with this library; if not, write to the Free Software
18// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19//
20// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21//
22
23// File: QtxMRUAction.h
24// Author: Sergey TELKOV
25//
26#ifndef QTXMRUACTION_H
27#define QTXMRUACTION_H
28
29#include "QtxAction.h"
30
31#include <QStringList>
32
33class QtxResourceMgr;
34
35#ifdef WIN32
36#pragma warning( disable:4251 )
37#endif
38
40{
41 Q_OBJECT
42
43public:
45 typedef enum { MoveFirst,
48 AddLast
49 } InsertionMode;
50
51 typedef enum { LinkAuto,
53 LinkFull
54 } LinkType;
55
56public:
57 QtxMRUAction( QObject* = 0 );
58 QtxMRUAction( const QString&, const QString&, QObject* = 0 );
59 QtxMRUAction( const QString&, const QIcon&, const QString&, QObject* = 0 );
60 virtual ~QtxMRUAction();
61
62 int insertMode() const;
63 void setInsertMode( const int );
64
65 int linkType() const;
66 void setLinkType( const int );
67
68 int count() const;
69 bool isEmpty() const;
70
71 int visibleCount() const;
72 void setVisibleCount( const int );
73
74 bool isClearPossible() const;
75 void setClearPossible( const bool );
76
77 int historyCount() const;
78 void setHistoryCount( const int );
79
80 void remove( const int );
81 void remove( const QString& );
82 void insert( const QString& );
83
84 QString item( const int ) const;
85 int find( const QString& ) const;
86 bool contains( const QString& ) const;
87
88 virtual void loadLinks( QtxResourceMgr*, const QString&, const bool = true );
89 virtual void saveLinks( QtxResourceMgr*, const QString&, const bool = true ) const;
90
91public slots:
92 void clear();
93
94signals:
95 void activated( const QString& );
96
97private slots:
98 void onActivated();
99 void onAboutToShow();
100 void onCleared( bool );
101
102private:
103 void updateMenu();
104
105private:
106 QStringList myLinks;
112};
113
114#endif
#define QTX_EXPORT
Definition: Qtx.h:36
For more information see QT documentation.
Generic action class.
Definition: QtxAction.h:39
Menu action which provides most recent used items support.
Definition: QtxMRUAction.h:40
@ LinkShort
put the only file name of link into the menu
Definition: QtxMRUAction.h:52
@ LinkAuto
put the full path of link into the menu if link file names of severals link are same
Definition: QtxMRUAction.h:51
@ AddFirst
if specified item doesn't exist, add it to the beginning
Definition: QtxMRUAction.h:47
@ MoveLast
put the specified item to the end
Definition: QtxMRUAction.h:46
int myInsertMode
items insertion policy
Definition: QtxMRUAction.h:111
int myVisCount
number of visible MRU items
Definition: QtxMRUAction.h:108
QAction * myClear
clear item
Definition: QtxMRUAction.h:107
QStringList myLinks
most recent used items
Definition: QtxMRUAction.h:106
int myHistoryCount
number of stored MRU items
Definition: QtxMRUAction.h:109
int myLinkType
type of link names in menu
Definition: QtxMRUAction.h:110
void activated(const QString &)
Emitted when user selects any MRU item in the menu.
Application resources manager.
Definition: QtxResourceMgr.h:53