Révision b489456c
original.cpp | ||
---|---|---|
62 | 62 |
item->setText(0, list.at(i).fileName()); |
63 | 63 |
item->setData(1,0,list.at(i).absoluteFilePath()); |
64 | 64 |
} |
65 |
|
|
66 |
//============== le menu contextuel du treewidget (gauche) |
|
67 |
m_menu = new QMenu(ui->treeWidget); |
|
68 |
QList<QAction*> actions; |
|
69 |
|
|
70 |
QAction *a_nouveau = new QAction(QIcon(":/images/folder_add.png"),trUtf8("&Nouvel album"),m_menu); |
|
71 |
a_nouveau->setIconVisibleInMenu(true); |
|
72 |
a_nouveau->connect(a_nouveau, SIGNAL(triggered()), this, SLOT(on_action_Nouvel_album_triggered())); |
|
73 |
|
|
74 |
QAction *a_renommer = new QAction(QIcon(":/images/folder_edit.png"),trUtf8("&Renommer..."),m_menu); |
|
75 |
a_renommer->setIconVisibleInMenu(true); |
|
76 |
//a_renommer->connect(a_renommer, SIGNAL(triggered()), this, SLOT(on_action_Nouvel_album_triggered())); |
|
77 |
|
|
78 |
QAction *a_supprimer = new QAction(QIcon(":/images/folder_delete.png"),trUtf8("&Supprimer..."),m_menu); |
|
79 |
a_supprimer->setIconVisibleInMenu(true); |
|
80 |
//a_supprimer->connect(a_supprimer, SIGNAL(triggered()), this, SLOT(on_action_Nouvel_album_triggered())); |
|
81 |
|
|
82 |
actions << a_nouveau << a_renommer << a_supprimer; |
|
83 |
m_menu->addActions(actions); |
|
65 | 84 |
} |
66 | 85 |
|
67 | 86 |
original::~original() |
... | ... | |
286 | 305 |
out << data; |
287 | 306 |
file.close(); |
288 | 307 |
} |
308 |
|
|
309 |
|
|
310 |
void original::on_treeWidget_customContextMenuRequested(const QPoint &pos) |
|
311 |
{ |
|
312 |
m_menu->exec(ui->treeWidget->mapToGlobal(pos)); |
|
313 |
} |
original.h | ||
---|---|---|
31 | 31 |
#include <exiv2/exif.hpp> |
32 | 32 |
#include <QTreeWidgetItem> |
33 | 33 |
#include <QListWidgetItem> |
34 |
#include <QMenu> |
|
34 | 35 |
|
35 | 36 |
namespace Ui { |
36 | 37 |
class original; |
... | ... | |
51 | 52 |
void on_commandLinkButton_clicked(); |
52 | 53 |
void on_btnSave_clicked(); |
53 | 54 |
|
55 |
void on_treeWidget_customContextMenuRequested(const QPoint &pos); |
|
56 |
|
|
54 | 57 |
private: |
55 | 58 |
Ui::original *ui; |
59 |
QMenu *m_menu; |
|
56 | 60 |
}; |
57 | 61 |
|
58 | 62 |
#endif // ORIGINAL_H |
original.ui | ||
---|---|---|
193 | 193 |
<height>16777215</height> |
194 | 194 |
</size> |
195 | 195 |
</property> |
196 |
<property name="contextMenuPolicy"> |
|
197 |
<enum>Qt::CustomContextMenu</enum> |
|
198 |
</property> |
|
196 | 199 |
<property name="editTriggers"> |
197 | 200 |
<set>QAbstractItemView::AllEditTriggers</set> |
198 | 201 |
</property> |
... | ... | |
254 | 257 |
</property> |
255 | 258 |
</action> |
256 | 259 |
<action name="action_Nouvel_album"> |
260 |
<property name="icon"> |
|
261 |
<iconset resource="resources.qrc"> |
|
262 |
<normaloff>:/images/folder_add.png</normaloff>:/images/folder_add.png</iconset> |
|
263 |
</property> |
|
257 | 264 |
<property name="text"> |
258 | 265 |
<string>&Nouvel album</string> |
259 | 266 |
</property> |
260 | 267 |
<property name="shortcut"> |
261 | 268 |
<string>Ctrl+N</string> |
262 | 269 |
</property> |
270 |
<property name="iconVisibleInMenu"> |
|
271 |
<bool>true</bool> |
|
272 |
</property> |
|
263 | 273 |
</action> |
264 | 274 |
</widget> |
265 | 275 |
<layoutdefault spacing="6" margin="11"/> |
... | ... | |
278 | 288 |
<tabstop>treeWidget</tabstop> |
279 | 289 |
<tabstop>lwPictures</tabstop> |
280 | 290 |
</tabstops> |
281 |
<resources/> |
|
291 |
<resources> |
|
292 |
<include location="resources.qrc"/> |
|
293 |
</resources> |
|
282 | 294 |
<connections> |
283 | 295 |
<connection> |
284 | 296 |
<sender>action_Quiter</sender> |
resources.qrc | ||
---|---|---|
1 | 1 |
<RCC> |
2 | 2 |
<qresource prefix="/"> |
3 |
<file>images/background.jpg</file> |
|
3 |
<file>images/folder_delete.png</file> |
|
4 |
<file>images/folder_add.png</file> |
|
5 |
<file>images/folder_edit.png</file> |
|
4 | 6 |
</qresource> |
5 | 7 |
</RCC> |
Formats disponibles : Unified diff