Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Understanding the doc format
Forum Updated to NodeBB v4.3 + New Features

Understanding the doc format

Scheduled Pinned Locked Moved Solved Qt for Python
4 Posts 2 Posters 491 Views
  • 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.
  • G Offline
    G Offline
    GaryN
    wrote on last edited by
    #1

    I am now trying to code my interface directly. This has progressed well so far, with sufficient tabs, a group box, labels, etc.
    I want to align the labels right.

    I went to the doc.qt.io and was told that:

    Qt::AlignRight
    

    I have already imported Qt from PyQt6.QtCore.

    I tried this:

    newgridcell = QLabel("Point of new grid cell:")
    newgridcell.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
    

    I get AttributeError: type object 'Qt' has no attribute 'AlignRight'

    If I remove Qt then, obvious, AlignRight is not defined
    If I just follow the document with Qt::AlignRight I, obviously, get SyntaxError: invalid syntax

    So, I am trying to...

    • resolve the immediate issue of aligning right
    • more importantly, trying to understand the structure of the documentation - for future usage

    Please help. :)

    JonBJ 1 Reply Last reply
    0
    • G GaryN

      I am now trying to code my interface directly. This has progressed well so far, with sufficient tabs, a group box, labels, etc.
      I want to align the labels right.

      I went to the doc.qt.io and was told that:

      Qt::AlignRight
      

      I have already imported Qt from PyQt6.QtCore.

      I tried this:

      newgridcell = QLabel("Point of new grid cell:")
      newgridcell.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
      

      I get AttributeError: type object 'Qt' has no attribute 'AlignRight'

      If I remove Qt then, obvious, AlignRight is not defined
      If I just follow the document with Qt::AlignRight I, obviously, get SyntaxError: invalid syntax

      So, I am trying to...

      • resolve the immediate issue of aligning right
      • more importantly, trying to understand the structure of the documentation - for future usage

      Please help. :)

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @GaryN
      I do not have Qt6/PyQt6/PySide6. Qt.AlightRight used to be correct. But I believe at Qt6 all these "global" constants/enumerations in Qt got moved into a more "specific" class/namespace. Try: Qt.AlignmentFlag.Align...?

      1 Reply Last reply
      2
      • G Offline
        G Offline
        GaryN
        wrote on last edited by
        #3

        Thank you so much. That also allowed me to begin to comprehend the structure of the documentation!

        Perfect. Not only do I have a solution but I have understanding. :)

        JonBJ 1 Reply Last reply
        0
        • G GaryN

          Thank you so much. That also allowed me to begin to comprehend the structure of the documentation!

          Perfect. Not only do I have a solution but I have understanding. :)

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @GaryN
          Be aware as you progress that this "move globals/enumerates into specific class/namespace" has basically happened everywhere in Qt6/PyQt6. Old code/examples are going to be wrong for loads of these, not just the alignment flag ones...!

          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