Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTimeEdit set unselectable

QTimeEdit set unselectable

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 4 Posters 455 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • sonichyS Offline
    sonichyS Offline
    sonichy
    wrote on last edited by
    #1

    I use a QTimeEdit to show time, but I do not want to select hour, minute, second (readonly is the same).
    How to set it like QLabel ?

    https://github.com/sonichy

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      If I understand you correctly you want to put the current time on a QLabel in the format hour minute second?

      Qt Certified Specialist
      www.edalsolutions.be

      1 Reply Last reply
      1
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by mrjj
        #3

        Hi
        I don't think there is an option to make the QTimeEdit widget 100% nonclickable.
        Outside of setDisabled(true), but that alter how it looks.

        Why not just use a label then?

        QDateTime dateTime = dateTime.currentDateTime();
        QString timeString = dateTime.toString("hh-mm-ss");
        ui->label->setText( timeString);

        1 Reply Last reply
        4
        • M Offline
          M Offline
          Milton
          wrote on last edited by Milton
          #4

          I had the same problem and made a subclass QLineView derived from QLineEdit tellsubway. Then, i reimplemented void setReadOnly(bool) and added a member var QPalette activePalette_

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved