[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/extragear/graphics/digikam/digikam
From: Marcel Wiesweg <marcel.wiesweg () gmx ! de>
Date: 2010-09-30 21:02:20
Message-ID: 20100930210220.6123DAC891 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1181380 by mwiesweg:
Ensure that box and view are available after construction
M +22 -22 addtagscombobox.cpp
M +6 -2 addtagscombobox.h
--- branches/extragear/graphics/digikam/digikam/addtagscombobox.cpp #1181379:1181380
@@ -63,10 +63,21 @@
: AlbumSelectComboBox(parent), d(new AddTagsComboBoxPriv)
{
QComboBox::setAutoCompletion(false);
- setEditable(true);
setCloseOnActivate(true);
setCheckable(false);
+ d->lineEdit = new AddTagsLineEdit(this);
+
+ connect(d->lineEdit, SIGNAL(taggingActionActivated(const TaggingAction&)),
+ this, SLOT(slotLineEditActionActivated(const TaggingAction&)));
+
+ d->lineEdit->setClearButtonShown(true);
+
+ TagTreeView::Flags flags;
+ d->treeView = new TagTreeView(this, flags);
+
+ connect(d->treeView, SIGNAL(activated(const QModelIndex&)),
+ this, SLOT(slotViewIndexActivated(const QModelIndex&)));
}
AddTagsComboBox::~AddTagsComboBox()
@@ -76,40 +87,28 @@
void AddTagsComboBox::setModel(TagModel* model, TagPropertiesFilterModel \
*filteredModel, CheckableAlbumFilterModel* filterModel) {
- // AlbumSelectComboBox calls virtual installView() and installLineEdit(), below
AlbumSelectComboBox::setModel(model, filterModel);
+
d->treeView->setAlbumModel(model);
d->treeView->setAlbumFilterModel(filteredModel, filterModel);
- connect(view(), SIGNAL(currentAlbumChanged(Album*)),
- this, SLOT(slotViewCurrentAlbumChanged(Album*)));
-
d->lineEdit->setTagModel(model);
}
void AddTagsComboBox::installLineEdit()
{
- delete d->lineEdit;
- d->lineEdit = new AddTagsLineEdit(this);
-
- connect(d->lineEdit, SIGNAL(taggingActionActivated(const TaggingAction&)),
- this, SLOT(slotLineEditActionActivated(const TaggingAction&)));
-
- d->lineEdit->setClearButtonShown(true);
- m_comboLineEdit = d->lineEdit;
setLineEdit(d->lineEdit);
}
-void AddTagsComboBox::installView(QAbstractItemView *view)
+void AddTagsComboBox::installView(QAbstractItemView *v)
{
- if (!view && !d->treeView)
+ AlbumSelectComboBox::installView(v ? v : d->treeView);
+}
+
+AddTagsLineEdit *AddTagsComboBox::lineEdit() const
{
- TagTreeView::Flags flags;
- d->treeView = new TagTreeView(this, flags);
+ return d->lineEdit;
}
- // called from initialize, tree view is constructed
- AlbumSelectComboBox::installView(view ? view : d->treeView);
-}
TagTreeView* AddTagsComboBox::view() const
{
@@ -164,9 +163,10 @@
return d->currentTaggingAction;
}
-void AddTagsComboBox::slotViewCurrentAlbumChanged(Album* album)
+void AddTagsComboBox::slotViewIndexActivated(const QModelIndex& index)
{
- d->lineEdit->selectAll();
+ TAlbum *album = view()->albumForIndex(index);
+ //d->lineEdit->selectAll();
if (album)
{
d->lineEdit->setText(album->title());
--- branches/extragear/graphics/digikam/digikam/addtagscombobox.h #1181379:1181380
@@ -32,6 +32,7 @@
namespace Digikam
{
+class AddTagsLineEdit;
class Album;
class CheckableAlbumFilterModel;
class TAlbum;
@@ -74,6 +75,9 @@
QString text() const;
void setText(const QString& text);
+ AddTagsLineEdit *lineEdit() const;
+ TagTreeView *view() const;
+
public Q_SLOTS:
/** Set a parent tag for suggesting a parent tag for a new tag, and a default \
action. */ @@ -92,13 +96,13 @@
protected Q_SLOTS:
- void slotViewCurrentAlbumChanged(Album* album);
+ void slotViewIndexActivated(const QModelIndex&);
void slotLineEditActionActivated(const TaggingAction& action);
protected:
+ /// Note: Requires a tag tree view
virtual void installView(QAbstractItemView *view = 0);
- TagTreeView* view() const;
virtual void sendViewportEventToView(QEvent* e);
private:
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic