Added drop-support to add dialog (closes #8)
If text is dropped in the add dialog, a receipt is added with that text.develop
parent
f6ff77571d
commit
9cc5af5142
|
@ -300,6 +300,22 @@ void DialogAdd::accept()
|
|||
delete this;
|
||||
}
|
||||
|
||||
void DialogAdd::dragEnterEvent(QDragEnterEvent *event)
|
||||
{
|
||||
if (event->mimeData()->hasFormat("text/plain"))
|
||||
{
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
}
|
||||
|
||||
void DialogAdd::dropEvent(QDropEvent *event)
|
||||
{
|
||||
const QString text = event->mimeData()->text();
|
||||
QListWidgetItem *item = new QListWidgetItem(text);
|
||||
item->setFlags(item->flags() | Qt::ItemIsEditable);
|
||||
list_receipts->insertItem(list_receipts->count(), item);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
|
|
@ -73,6 +73,8 @@ public:
|
|||
|
||||
private:
|
||||
const Dialogdata get_data() const;
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dropEvent(QDropEvent *event);
|
||||
|
||||
MainWindow *_parent;
|
||||
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="acceptDrops">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Add entry</string>
|
||||
</property>
|
||||
|
|
|
@ -4,62 +4,62 @@
|
|||
<context>
|
||||
<name>DialogAdd</name>
|
||||
<message>
|
||||
<location filename="../src/whyblocked_add.ui" line="14"/>
|
||||
<location filename="../src/whyblocked_add.ui" line="17"/>
|
||||
<source>Add entry</source>
|
||||
<translation>Eintrag hinzufügen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/whyblocked_add.ui" line="37"/>
|
||||
<location filename="../src/whyblocked_add.ui" line="40"/>
|
||||
<source>Memory aids, proof</source>
|
||||
<translation>Gedächtnisstützen, Beweise</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/whyblocked_add.ui" line="40"/>
|
||||
<location filename="../src/whyblocked_add.ui" line="43"/>
|
||||
<source>Rece&ipts</source>
|
||||
<translation>Be&lege</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/whyblocked_add.ui" line="53"/>
|
||||
<location filename="../src/whyblocked_add.ui" line="56"/>
|
||||
<source>Add receipt</source>
|
||||
<translation>Beleg hinzufügen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/whyblocked_add.ui" line="56"/>
|
||||
<location filename="../src/whyblocked_add.ui" line="59"/>
|
||||
<source>&Add</source>
|
||||
<translation>&Hinzufügen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/whyblocked_add.ui" line="76"/>
|
||||
<location filename="../src/whyblocked_add.ui" line="79"/>
|
||||
<source>&Blocked</source>
|
||||
<translation>&Blockiert</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/whyblocked_add.ui" line="95"/>
|
||||
<location filename="../src/whyblocked_add.ui" line="98"/>
|
||||
<source>&Silenced</source>
|
||||
<translation>&Gedämpft</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/whyblocked_add.ui" line="102"/>
|
||||
<location filename="../src/whyblocked_add.ui" line="105"/>
|
||||
<source>R&eason</source>
|
||||
<translation>B&egründung</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/whyblocked_add.ui" line="131"/>
|
||||
<location filename="../src/whyblocked_add.ui" line="134"/>
|
||||
<source>Blocked/Silenced</source>
|
||||
<translation>Blockiert/Gedämpft</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/whyblocked_add.ui" line="141"/>
|
||||
<location filename="../src/whyblocked_add.ui" line="144"/>
|
||||
<source>&User/Instance</source>
|
||||
<translation>Ben&utzer/Instanz</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/whyblocked_add.ui" line="151"/>
|
||||
<location filename="../src/whyblocked_add.ui" line="154"/>
|
||||
<source>Remove receipt</source>
|
||||
<translation>Beleg entfernen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/whyblocked_add.ui" line="154"/>
|
||||
<location filename="../src/whyblocked_add.ui" line="157"/>
|
||||
<source>Re&move</source>
|
||||
<translation>Ent&fernen</translation>
|
||||
</message>
|
||||
|
|
|
@ -4,62 +4,62 @@
|
|||
<context>
|
||||
<name>DialogAdd</name>
|
||||
<message>
|
||||
<location filename="../src/whyblocked_add.ui" line="14"/>
|
||||
<location filename="../src/whyblocked_add.ui" line="17"/>
|
||||
<source>Add entry</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/whyblocked_add.ui" line="37"/>
|
||||
<location filename="../src/whyblocked_add.ui" line="40"/>
|
||||
<source>Memory aids, proof</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/whyblocked_add.ui" line="40"/>
|
||||
<location filename="../src/whyblocked_add.ui" line="43"/>
|
||||
<source>Rece&ipts</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/whyblocked_add.ui" line="53"/>
|
||||
<location filename="../src/whyblocked_add.ui" line="56"/>
|
||||
<source>Add receipt</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/whyblocked_add.ui" line="56"/>
|
||||
<location filename="../src/whyblocked_add.ui" line="59"/>
|
||||
<source>&Add</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/whyblocked_add.ui" line="76"/>
|
||||
<location filename="../src/whyblocked_add.ui" line="79"/>
|
||||
<source>&Blocked</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/whyblocked_add.ui" line="95"/>
|
||||
<location filename="../src/whyblocked_add.ui" line="98"/>
|
||||
<source>&Silenced</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/whyblocked_add.ui" line="102"/>
|
||||
<location filename="../src/whyblocked_add.ui" line="105"/>
|
||||
<source>R&eason</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/whyblocked_add.ui" line="131"/>
|
||||
<location filename="../src/whyblocked_add.ui" line="134"/>
|
||||
<source>Blocked/Silenced</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/whyblocked_add.ui" line="141"/>
|
||||
<location filename="../src/whyblocked_add.ui" line="144"/>
|
||||
<source>&User/Instance</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/whyblocked_add.ui" line="151"/>
|
||||
<location filename="../src/whyblocked_add.ui" line="154"/>
|
||||
<source>Remove receipt</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/whyblocked_add.ui" line="154"/>
|
||||
<location filename="../src/whyblocked_add.ui" line="157"/>
|
||||
<source>Re&move</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
Loading…
Reference in New Issue