Results 1 to 2 of 2

Thread: Role to display QLabel?

  1. #1
    Join Date
    Dec 2009
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Role to display QLabel?

    hello... in my data() overriding i have a column where i must display a clickable text in everyitem that opens a QDialog when clicked... im trying to use a QLabel for that. The QDialog is already done too. (ActiveLabel already have the clicked() support)

    In this example im returning just the text of the QLabel using Qt:isplayRole, but i want this text to open the sentToDialog when clicked, can someone help me on how is that possible?

    Qt Code:
    1. if (column == SenderColumn) {
    2. switch (role) {
    3. case Qt::DisplayRole:
    4. SentToDialog* sentToDialog = new SentToDialog();
    5. ActiveLabel* reglabel = new ActiveLabel(sentToDialog);
    6. return reglabel->text();
    7. }
    8. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Role to display QLabel?

    The view has a clicked() signal you can connect to.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. synchronise QLabel display and webcam capture
    By fbmfbm in forum Qt Programming
    Replies: 2
    Last Post: 24th February 2009, 11:10
  2. Replies: 7
    Last Post: 13th August 2008, 18:27
  3. can Qlabel display a series of image one by one ?
    By jirach_gag in forum Qt Tools
    Replies: 3
    Last Post: 11th August 2008, 15:36
  4. Display QLabel in two lines
    By arunvv in forum Newbie
    Replies: 1
    Last Post: 8th February 2008, 05:25
  5. QScrollArea display custom QLabel
    By spawnwj in forum Qt Programming
    Replies: 6
    Last Post: 6th December 2006, 03:38

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.