ItemDelegate events

Alles rund um die Programmierung mit Qt
Antworten
DBGTMaster
Beiträge: 190
Registriert: 19. August 2010 10:00

ItemDelegate events

Beitrag von DBGTMaster »

Hallo,

in einem Itemdelegate eines Views Zeichne ich in eine Spalte nebeneinanderstehend immer Wochentage:

Code: Alles auswählen

        while (!retrospectiveData.isEmpty()) {

            QString color = retrospectiveData.at(0);
            QString dayOfMonth = QString( retrospectiveData.at(1) ) + retrospectiveData.at(2);

            retrospectiveData.remove(0, 3);

            if (color == "g") {
                painter->setPen(QColor(37, 203, 7));
            }
            else if (color == "y") {
                painter->setPen(QColor(215, 209, 0));
            }
            else if (color == "b") {
                painter->setPen(QColor(20, 30, 190));
            }
            else if (color == "r") {
                painter->setPen(QColor(210, 0, 0));
            }

            painter->drawText(x, y + (option.rect.height() / 2), dayOfMonth);
            x = x + 17;
        }
Das ganze sieht nun so aus:
Unbenannt.png
Unbenannt.png (8.11 KiB) 1796 mal betrachtet
Nun möchte ich, wenn man mit der Maus zB. über "MO" fährt, dass ein Popup aufpoppt, indem ich weitere Informationen sehe.

Wie löse ich dieses am besten?
Antworten