aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Noldor2008-05-04 10:11:47 +0000
committerGravatar Noldor2008-05-04 10:11:47 +0000
commitfa619de962f603597d9d73fffec7bfcf124c9750 (patch)
tree93035f9f327db5cdd9176109423824029cdebdea
parenttheme dialog QT4 port (wip) + some fixes (diff)
downloadKVIrc-fa619de962f603597d9d73fffec7bfcf124c9750.tar.gz
KVIrc-fa619de962f603597d9d73fffec7bfcf124c9750.tar.bz2
KVIrc-fa619de962f603597d9d73fffec7bfcf124c9750.zip
more theme dialog QT4 port (wip)
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@1667 17fca916-40b9-46aa-a4ea-0a15b648b75c
-rw-r--r--src/modules/theme/managementdialog.cpp17
-rw-r--r--src/modules/theme/managementdialog.h2
2 files changed, 10 insertions, 9 deletions
diff --git a/src/modules/theme/managementdialog.cpp b/src/modules/theme/managementdialog.cpp
index 2bf030e06..e250a902f 100644
--- a/src/modules/theme/managementdialog.cpp
+++ b/src/modules/theme/managementdialog.cpp
@@ -232,16 +232,17 @@ KviThemeManagementDialog::KviThemeManagementDialog(QWidget * parent)
w->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum);
m_pListBox = new QListWidget(this);
+ m_pListBox->setContextMenuPolicy(Qt::CustomContextMenu);
m_pListBox->setItemDelegate(new KviThemeDelegate(m_pListBox));
m_pListBox->setMinimumHeight(400);
m_pListBox->setMinimumWidth(400);
m_pListBox->setSelectionMode(QAbstractItemView::ExtendedSelection);
m_pListBox->setSortingEnabled(true);
- connect(m_pListBox,SIGNAL(doubleClicked(KviTalListBoxItem *)),this,SLOT(applyTheme(KviTalListBoxItem *)));
- connect(m_pListBox,SIGNAL(contextMenuRequested(KviTalListBoxItem *,const QPoint &)),
- this,SLOT(contextMenuRequested(KviTalListBoxItem *,const QPoint &)));
- connect(m_pListBox,SIGNAL(selectionChanged()),this,SLOT(enableDisableButtons()));
+ connect(m_pListBox,SIGNAL(itemActivated(QListWidgetItem *)),this,SLOT(applyTheme(QListWidgetItem *)));
+ connect(m_pListBox,SIGNAL(customContextMenuRequested(const QPoint &)),
+ this,SLOT(contextMenuRequested(const QPoint &)));
+ connect(m_pListBox,SIGNAL(itemSelectionChanged()),this,SLOT(enableDisableButtons()));
g->addMultiCellWidget(m_pListBox,1,1,0,1);
KviDynamicToolTip * tip = new KviDynamicToolTip(m_pListBox);
@@ -312,15 +313,15 @@ void KviThemeManagementDialog::packTheme()
}
-void KviThemeManagementDialog::contextMenuRequested(QListWidgetItem * it,const QPoint & pos)
+void KviThemeManagementDialog::contextMenuRequested(const QPoint & pos)
{
- if(it)
+ if(m_pListBox->itemAt(pos)!=0)
{
- m_pListBox->setCurrentItem(it);
+ m_pListBox->setCurrentItem(m_pListBox->itemAt(pos));
m_pContextPopup->clear();
m_pContextPopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_MINUS)),__tr2qs_ctx("&Remove Theme","theme"),this,SLOT(deleteTheme()));
m_pContextPopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_ACCEPT)),__tr2qs_ctx("&Apply Theme","theme"),this,SLOT(applyCurrentTheme()));
- m_pContextPopup->popup(pos);
+ m_pContextPopup->popup(m_pListBox->viewport()->mapToGlobal(pos));
}
}
diff --git a/src/modules/theme/managementdialog.h b/src/modules/theme/managementdialog.h
index 464ae872b..b799040a5 100644
--- a/src/modules/theme/managementdialog.h
+++ b/src/modules/theme/managementdialog.h
@@ -90,7 +90,7 @@ protected slots:
void applyTheme(QListWidgetItem *);
void applyCurrentTheme();
void enableDisableButtons();
- void contextMenuRequested(QListWidgetItem * item, const QPoint & pos);
+ void contextMenuRequested(const QPoint & pos);
void tipRequest(KviDynamicToolTip *pTip,const QPoint &pnt);
};
class KviThemeDelegate : public QItemDelegate