# # # patch "src/view/AttributesView.cpp" # from [f815426941c4a99796b7d9f05da890e614f14fa7] # to [e4b0b75ba4c9abd6fa8efa2c6def8a4f2ae6dc96] # # patch "src/view/AttributesView.h" # from [80630071659d7628915dcd81f8adaa9f7b934638] # to [919369059dde5efb8b1e8b0c0d1e25e49dfc6825] # ============================================================ --- src/view/AttributesView.cpp f815426941c4a99796b7d9f05da890e614f14fa7 +++ src/view/AttributesView.cpp e4b0b75ba4c9abd6fa8efa2c6def8a4f2ae6dc96 @@ -23,6 +23,8 @@ #include "AddEditAttribute.h" #include "Guitone.h" +#include + // FIXME: this dependency is ugly, we should probably use // Qt's row editing, but this is ugly (and complex) // to implement as well @@ -48,6 +50,11 @@ AttributesView::AttributesView(QWidget * this, SIGNAL(contextMenuRequested(const QModelIndexList &, const QPoint &)), this, SLOT(menuRequested(const QModelIndexList &, const QPoint &)) ); + + connect( + this, SIGNAL(doubleClicked(const QModelIndex &)), + this, SLOT(aboutToEditAttribute(const QModelIndex &)) + ); } AttributesView::~AttributesView() {} @@ -93,9 +100,14 @@ void AttributesView::menuRequested(const selectedIndex = indexes.at(0); QMenu popupMenu(this); + + QFont activeFont; + activeFont.setBold(true); + popupMenu.addAction( tr("edit attribute"), this, SLOT(editAttribute()) - ); + )->setFont(activeFont); + popupMenu.addAction( tr("drop attribute"), this, SLOT(dropAttribute()) ); @@ -131,6 +143,13 @@ void AttributesView::addAttribute() } } +void AttributesView::aboutToEditAttribute(const QModelIndex & index) +{ + if (!index.isValid()) return; + selectedIndex = index; + editAttribute(); +} + void AttributesView::editAttribute() { QModelIndex keyIdx = model()->index(selectedIndex.row(), 1, QModelIndex()); ============================================================ --- src/view/AttributesView.h 80630071659d7628915dcd81f8adaa9f7b934638 +++ src/view/AttributesView.h 919369059dde5efb8b1e8b0c0d1e25e49dfc6825 @@ -38,6 +38,7 @@ private slots: void addAttribute(); void editAttribute(); + void aboutToEditAttribute(const QModelIndex &); void dropAttribute(); private: