~ubuntu-branches/ubuntu/saucy/digikam/saucy

« back to all changes in this revision

Viewing changes to digikam/imageselectionoverlay.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-12-21 23:19:11 UTC
  • mfrom: (1.2.33 upstream) (3.1.7 experimental)
  • Revision ID: james.westby@ubuntu.com-20101221231911-z9jip7s5aht1jqn9
Tags: 2:1.7.0-1ubuntu1
* Merge from Debian Experimental. Remaining Ubuntu changes:
  - Export .pot name and copy to plugins in debian/rules
  - Version build-depends on kipi-plugins-dev to ensure build is against the
    same version on all archs
* Drop debian/patches/kubuntu_01_linker.diff, incoporated upstream
* Remove patches directory and unused patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
namespace Digikam
38
38
{
39
39
 
40
 
ImageSelectionOverlayButton::ImageSelectionOverlayButton(QAbstractItemView *parentView)
41
 
                           : ItemViewHoverButton(parentView)
 
40
ImageSelectionOverlayButton::ImageSelectionOverlayButton(QAbstractItemView* parentView)
 
41
    : ItemViewHoverButton(parentView)
42
42
{
43
43
}
44
44
 
58
58
void ImageSelectionOverlayButton::updateToolTip()
59
59
{
60
60
    setToolTip(isChecked() ? i18nc("@info:tooltip", "Deselect Item") :
61
 
                             i18nc("@info:tooltip", "Select Item"));
 
61
               i18nc("@info:tooltip", "Select Item"));
62
62
}
63
63
 
64
64
// --------------------------------------------------------------------
65
65
 
66
 
ImageSelectionOverlay::ImageSelectionOverlay(QObject *parent)
67
 
                     : HoverButtonDelegateOverlay(parent)
 
66
ImageSelectionOverlay::ImageSelectionOverlay(QObject* parent)
 
67
    : HoverButtonDelegateOverlay(parent)
68
68
{
69
69
}
70
70
 
89
89
    }
90
90
}
91
91
 
92
 
ItemViewHoverButton *ImageSelectionOverlay::createButton()
 
92
ItemViewHoverButton* ImageSelectionOverlay::createButton()
93
93
{
94
94
    return new ImageSelectionOverlayButton(view());
95
95
}
110
110
void ImageSelectionOverlay::slotClicked(bool checked)
111
111
{
112
112
    QModelIndex index = button()->index();
 
113
 
113
114
    if (index.isValid())
114
115
    {
115
116
        QItemSelectionModel* selModel = m_view->selectionModel();
 
117
 
116
118
        if (checked)
117
119
        {
118
120
            selModel->select(index, QItemSelectionModel::Select);
121
123
        {
122
124
            selModel->select(index, QItemSelectionModel::Deselect);
123
125
        }
 
126
 
124
127
        selModel->setCurrentIndex(index, QItemSelectionModel::Current);
125
128
    }
126
129
}
128
131
void ImageSelectionOverlay::slotSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected)
129
132
{
130
133
    QModelIndex index = button()->index();
 
134
 
131
135
    if (index.isValid())
132
136
    {
133
137
        if (selected.contains(index))
 
138
        {
134
139
            button()->setChecked(true);
 
140
        }
135
141
        else if (deselected.contains(index))
 
142
        {
136
143
            button()->setChecked(false);
 
144
        }
137
145
    }
138
146
}
139
147