+ fix a few minor issues in DlgWorkbenchesImp and QListWidgetCustom

This commit is contained in:
wmayer 2015-05-20 11:18:46 +02:00
parent d5ae1988b8
commit dbfedbdeae
4 changed files with 14 additions and 12 deletions

View File

@ -42,7 +42,7 @@ using namespace Gui::Dialog;
const QString DlgWorkbenchesImp::all_workbenches = QString::fromAscii("ALL"); const QString DlgWorkbenchesImp::all_workbenches = QString::fromAscii("ALL");
/* TRANSLATOR Gui::Dialog::DlgWorkbenches */ /* TRANSLATOR Gui::Dialog::DlgWorkbenchesImp */
DlgWorkbenchesImp::DlgWorkbenchesImp(QWidget* parent) DlgWorkbenchesImp::DlgWorkbenchesImp(QWidget* parent)
: CustomizeActionPage(parent) : CustomizeActionPage(parent)
@ -59,16 +59,14 @@ DlgWorkbenchesImp::DlgWorkbenchesImp(QWidget* parent)
for (QStringList::Iterator it = enabled_wbs_list.begin(); it != enabled_wbs_list.end(); ++it) { for (QStringList::Iterator it = enabled_wbs_list.begin(); it != enabled_wbs_list.end(); ++it) {
if (workbenches.contains(*it)) { if (workbenches.contains(*it)) {
QString wb = *it; add_workbench(lw_enabled_workbenches, *it);
add_workbench(lw_enabled_workbenches, wb);
} else { } else {
qDebug() << "Ignoring unknown " << it->toLatin1() << " workbench found in user preferences."; qDebug() << "Ignoring unknown" << *it << "workbench found in user preferences.";
} }
} }
for (QStringList::Iterator it = workbenches.begin(); it != workbenches.end(); ++it) { for (QStringList::Iterator it = workbenches.begin(); it != workbenches.end(); ++it) {
if (!enabled_wbs_list.contains(*it)){ if (!enabled_wbs_list.contains(*it)){
QString wb = *it; add_workbench(lw_disabled_workbenches, *it);
add_workbench(lw_disabled_workbenches, wb);
} }
} }
lw_enabled_workbenches->setCurrentRow(0); lw_enabled_workbenches->setCurrentRow(0);
@ -90,7 +88,7 @@ void DlgWorkbenchesImp::set_lw_properties(QListWidgetCustom *lw)
lw->setDefaultDropAction(Qt::MoveAction); lw->setDefaultDropAction(Qt::MoveAction);
} }
void DlgWorkbenchesImp::add_workbench(QListWidgetCustom *lw, QString it) void DlgWorkbenchesImp::add_workbench(QListWidgetCustom *lw, const QString& it)
{ {
QPixmap px = Application::Instance->workbenchIcon(it); QPixmap px = Application::Instance->workbenchIcon(it);
QString mt = Application::Instance->workbenchMenuText(it); QString mt = Application::Instance->workbenchMenuText(it);

View File

@ -57,7 +57,7 @@ protected Q_SLOTS:
private: private:
void set_lw_properties(QListWidgetCustom *lw); void set_lw_properties(QListWidgetCustom *lw);
void add_workbench(QListWidgetCustom *lw, QString it); void add_workbench(QListWidgetCustom *lw, const QString& it);
void move_workbench(QListWidgetCustom *lwc_dest, void move_workbench(QListWidgetCustom *lwc_dest,
QListWidgetItem *wi); QListWidgetItem *wi);
void save_enabled_workbenches(); void save_enabled_workbenches();

View File

@ -60,3 +60,5 @@ void QListWidgetCustom::dragMoveEvent(QDragMoveEvent *e)
e->ignore(); e->ignore();
} }
} }
#include "moc_QListWidgetCustom.cpp"

View File

@ -28,11 +28,13 @@
#include <QDragMoveEvent> #include <QDragMoveEvent>
#include <QString> #include <QString>
class QListWidgetCustom : public QListWidget { class QListWidgetCustom : public QListWidget
{
Q_OBJECT
public: public:
QListWidgetCustom (QWidget *parent); QListWidgetCustom (QWidget *parent);
~QListWidgetCustom (); virtual ~QListWidgetCustom ();
protected: protected:
void dragMoveEvent(QDragMoveEvent *e); void dragMoveEvent(QDragMoveEvent *e);