diff options
author | Arno <am@disconnect.de> | 2013-04-10 21:36:26 +0200 |
---|---|---|
committer | Arno <am@disconnect.de> | 2013-04-10 21:36:26 +0200 |
commit | a39a1118320c2c2e291f9e771ab75d32549431a7 (patch) | |
tree | a82ae27aa4e0e398e99b1127b51d65da36f1c5b9 /shemov.cpp | |
parent | 69791ade746638180a959c190fa5db6519c83a38 (diff) | |
download | SheMov-a39a1118320c2c2e291f9e771ab75d32549431a7.tar.gz SheMov-a39a1118320c2c2e291f9e771ab75d32549431a7.tar.bz2 SheMov-a39a1118320c2c2e291f9e771ab75d32549431a7.zip |
Fix setAlternatignRowColors
Well, what started as a try to simplify QTreeView ended in a mass header
murder...
What happened:
* I searched for a way to let every QTreeView honor the
setAlternatingRowcolors() setting. Unfortunately it isn't enough to just
set the global palette and set it to true. So every QTreeView is now
derived from SmTreeView
* SmTreeView registers itself with SmGlobals, so the property is set
_after_ it's constructed. It's definitely not enough to call it in the
constructor. I guess that's a bug. But it's enough to append the
SmTreeView to a QList<QWidget*> in SmGlobals and call it _after_ the
painting is done.
* As an added Bonus we can add virt. funcs to every SmTreeView at will
While at it I realized that most of the included headers were void, so
remove them. No idea what impact it has on the bin size...
Diffstat (limited to 'shemov.cpp')
-rw-r--r-- | shemov.cpp | 32 |
1 files changed, 13 insertions, 19 deletions
@@ -59,6 +59,7 @@ #include "pictureviewer2.h" #include "helper.h" #include "smdirmodel.h" +#include "smtreeview.h" SheMov::SheMov(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, flags), mOpenWithGroupFS(0), mOpenWithGroupAV(0) { //application icon @@ -104,7 +105,7 @@ SheMov::SheMov(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, fla connect(mPicWidget->picView(), SIGNAL(selectedSize(qint64)), this, SLOT(setSize(qint64))); PictureViewer2 *picViewer = SmGlobals::instance()->pictureViewer(); - //newmoviewizard + dbanalyzer + //newmoviewizard + dbanalyzer + newpicsdialog splash.showMessage(tr("Creating misc. Dialogs..."), Qt::AlignHCenter, Qt::yellow); qApp->processEvents(); mNewMovieWizard = new NewMovieWizard(this); @@ -112,6 +113,7 @@ SheMov::SheMov(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, fla mDbAnalyzerDialog = new DbAnalyzerDialog(this); connect(mDbAnalyzerDialog, SIGNAL(partClicked(int, int)), mATree, SLOT(selectMoviePart(int, int))); connect(mDbAnalyzerDialog, SIGNAL(delItems(int,QList<int>&)), this, SLOT(analyzeDelete(int,QList<int>&))); + mNewPicsDialog = new NewPicsDialog(this); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(mTab); @@ -144,6 +146,7 @@ SheMov::SheMov(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, fla QWidget *centralWidget = new QWidget; centralWidget->setLayout(mainLayout); setCentralWidget(centralWidget); + show(); splash.finish(this); mATree->readSettings(); @@ -398,8 +401,6 @@ void SheMov::createActions(){ connect(mConsistencyA, SIGNAL(triggered()), this, SLOT(checkConsistency())); mAnalyzerA = new QAction(QIcon(":/higheels.png"), tr("Analyze Db..."), this); connect(mAnalyzerA, SIGNAL(triggered()), this, SLOT(analyzeDb())); - mMappingEditorA = new QAction(tr("Mapping editor..."), this); - connect(mMappingEditorA, SIGNAL(triggered()), this, SLOT(mappingEditor())); mNewPicsA = new QAction(tr("Archive pics...."), this); connect(mNewPicsA, SIGNAL(triggered()), this, SLOT(newPicsDialog())); @@ -765,7 +766,7 @@ void SheMov::createMenus(){ fileMenu->addSeparator(); fileMenu->addAction(mConsistencyA); fileMenu->addAction(mAnalyzerA); - fileMenu->addAction(mMappingEditorA); + //fileMenu->addAction(mMappingEditorA); fileMenu->addSeparator(); fileMenu->addAction(mQuitA); menuBar()->addMenu(fileMenu); @@ -1110,9 +1111,11 @@ void SheMov::createPalette(){ pal.setColor(QPalette::Base, Qt::white); pal.setColor(QPalette::AlternateBase, Qt::white); } - qApp->setPalette(pal); foreach(QWidget *w, SmGlobals::instance()->treeWidgets()){ - w->setPalette(pal); + SmTreeView *aiv = qobject_cast<SmTreeView*>(w); + if(aiv){ + aiv->setPalette(pal); + } } } @@ -1171,18 +1174,8 @@ void SheMov::editMappings(QString table){ ed.exec(); } -void SheMov::mappingEditor(){ - QDialog dlg(this); - QHBoxLayout *dlgLayout = new QHBoxLayout; - MappingTreeWidget *mtw = new MappingTreeWidget; - dlgLayout->addWidget(mtw); - dlg.setLayout(dlgLayout); - dlg.exec(); -} - void SheMov::newPicsDialog(){ - NewPicsDialog npd(this); - npd.exec(); + mNewPicsDialog->exec(); } void SheMov::newPicsDialogWithFiles(){ @@ -1194,6 +1187,7 @@ void SheMov::newPicsDialogWithFiles(){ foreach(QModelIndex idx, selected){ files << idx.data(SmDirModel::FullPathRole).toString(); } - NewPicsDialog npd(files, this); - npd.exec(); + mNewPicsDialog->clearFiles(); + mNewPicsDialog->addFiles(files); + mNewPicsDialog->exec(); } |