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. Styling a QDateEdit
Qt 6.11 is out! See what's new in the release blog

Styling a QDateEdit

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 941 Views 1 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.
  • D Offline
    D Offline
    DalePennington
    wrote on last edited by
    #1

    I am attempting to modify a QDateEdit control so that the drop down button is wider. From what I have been researching the following Style Sheet should work

    QDateEdit
    {
        color: white;
        background-color: black;
    }
    
    QDateEdit::drop-down
    {
        height: 60px;
        width: 100px;
    }
    

    I know that width is exaggerated, but I wanted to try and get something. The main QDateEdit is to invert the normal colors, and that shows up as expected in my sample app, the drop down width does not ever seem to change. I added a

    background-color: green;
    

    To the drop-down window to see if that would get picked up and it did (after I moved my window instantiation after the style sheet loading). so I have a green drop down button with no visible icon when it is present, but the width still stays the same. That at least implies that the style in being somewhat read.

    Any ideas what I am doing wrong ? And how to get it to work.

    Thanks,
    Dale Pennington

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Based on the Sub-controls part, it looks like you have to also set the position related properties and then you can apply the usual box model modifications.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      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