Skip to content

Language Bindings

You're using Qt with other languages than C++, eh? Post here!
852 Topics 3.3k Posts

QtWS: Early Bird Tickets Available!

  • 0 Votes
    9 Posts
    1k Views
    JonBJ

    @SGaist It's just that your predictions are uncanny, i.e. scary ;-)

  • Porting from Embarcadero C++

    Unsolved
    1
    0 Votes
    1 Posts
    395 Views
    No one has replied
  • Python in QT

    Solved
    8
    0 Votes
    8 Posts
    1k Views
    G

    Thank you all for the discussion

  • Can qt integrate with software developed by tk

    Locked Unsolved
    1
    0 Votes
    1 Posts
    399 Views
    No one has replied
  • how can i get a list of all open windows?

    Unsolved
    1
    0 Votes
    1 Posts
    639 Views
    No one has replied
  • Unexpected compiler version, expected Clang 9.0.0 or newer

    Solved
    10
    1 Votes
    10 Posts
    5k Views
    oblivioncthO

    I have this same problem on Qt Creator 4.12.2 (From revision 33c5ff216a) but I don't have Clang anywhere on my system, other than the distribution that comes with Qt. I am using Qt 5.15.0 with MSVC2019.

    It doesn't seem like there is a way to download the linked beta build any longer as the listed artifacts are not in anyway hyperlinked, though perhaps you have to go somewhere else that I'm missing.

    I was using Qt 5.14.3 with MSVC2019 on another system without issue but it hasn't been updated in a while so I guess the 16.5 update was the issue.

    I'm guessing that even though it has been a bit since this issue was posted that the latest official version of Qt Creator still using Clang 8.0.

    Is there another link to that beta build that anyone has?

    EDIT:

    Never mind, I eventually correctly guessed that you have to be logged into github in order to download artifacts from these builds for whatever reason.

    Using this build also fixed the issue for me.

  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    10 Views
    No one has replied
  • 0 Votes
    6 Posts
    1k Views
    SGaistS

    Thanks for the links !

  • PySide2 - Serial communication QSerialPort or pyserial

    Unsolved
    7
    0 Votes
    7 Posts
    5k Views
    A

    I am preparing a patch to support QSerialPort in PySide2 here:
    https://codereview.qt-project.org/c/pyside/pyside-setup/+/299976

  • QtJambi 5.12.8 is nearly alive!

    Solved
    4
    2 Votes
    4 Posts
    699 Views
    SGaistS

    Great !

    Since you have it alive now please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found.

  • add delay in python

    Unsolved
    5
    0 Votes
    5 Posts
    4k Views
    W

    Sleep() function actually suspends the processing of the thread in which it is called by the operating system, allowing other threads and processes to execute while it sleeps. With multiple threads and processes, sleep() suspends your thread - it uses next to zero processing power.

  • 0 Votes
    5 Posts
    1k Views
    AdantehA

    @SGaist
    Unfortunately I am locked into Qt4 with the program itself. Heck, I was even hoping I could somehow influence this Qt4 app by some external python app running Pyside2. I have no idea how any of the underlying Qt infrastructure works, but that seems very far from possible (at least for me)

    My experience with PyQt5 and Pyside2 has been super pleasant and I feel really comfortable in Python, and not comfortable at all in C++, so that's why I'm looking around if there's an alternative.

    Ill probably give this a go for starters: https://ubuverse.com/embedding-the-python-interpreter-in-a-qt-application/

  • QByteArray to string?

    Solved
    29
    -1 Votes
    29 Posts
    30k Views
    JonBJ

    @germyrinn
    Hi, this was an old post of mine.

    As I wrote, the problem is that for the £ sign e.g. read from a file created in the way I describe, decode("utf-8") gives me a UnicodeDecodeError. I found the only conversion which works is decode("cp850").

  • 0 Votes
    11 Posts
    1k Views
    JonBJ

    @SGaist
    OIC. So

    how to change the file name from German to English or vice-versa

    The OP does not really mean change the filename (on disk)? Then there is no issue.

  • Camera Example Error

    Solved
    2
    0 Votes
    2 Posts
    586 Views
    N

    @Nick79
    I resolved it. On my linux machine I had to install some gstreamer packages. Now everything works! Great

  • iso 646de

    Unsolved
    2
    0 Votes
    2 Posts
    410 Views
    SGaistS

    Hi and welcome to devnet,

    QTextCodec comes to mind for that task.

  • 0 Votes
    4 Posts
    714 Views
    Gojir4G

    @galou_breizh I answered in the other post. But it's not a good way to duplicate post for the same issue. Please try to avoid it in the future, thanks

  • PySide2: Filling not scaled

    Unsolved
    3
    0 Votes
    3 Posts
    625 Views
    Gojir4G

    @galou_breizh
    I think point_size is too small and the ellipse generated is "pixelated" because of that.

    This gives a nice circle filled with blue

    # -*- coding: utf-8 -*- """Show an incomprehension in setScale for QGraphicsItemGroup.""" from PySide2 import QtCore from PySide2 import QtGui from PySide2 import QtWidgets point_size = 10.0 # In real-world units. # Get entrypoint through which we control underlying Qt framework app = QtWidgets.QApplication([]) scene = QtWidgets.QGraphicsScene() group = QtWidgets.QGraphicsItemGroup() scale = 50.0 # 1 real-world units = 500 px. !! Has no apparent effect. pen = QtGui.QPen(QtCore.Qt.red) brush = QtGui.QBrush(QtCore.Qt.blue) x = 1.0 # Real-world units. y = 2.0 # Real-world units. top_left = (x - point_size / 2.0, y - point_size / 2.0) ellipse = QtWidgets.QGraphicsEllipseItem( QtCore.QRectF(*top_left, point_size, point_size)) ellipse.setPen(pen) ellipse.setBrush(brush) ellipse.setScale(scale) group.addToGroup(ellipse) # group.setScale(scale) scene.addItem(group) view = QtWidgets.QGraphicsView(scene) view.show() # Start Qt/PySide2 application. If we don't show any windows, the # app would just loop at this point without the means to exit app.exec_()
  • Experiences with QtSharp and Qml.Net

    Unsolved
    1
    0 Votes
    1 Posts
    558 Views
    No one has replied
  • how do i separate these sudoku boxes (grids)

    Unsolved
    4
    0 Votes
    4 Posts
    645 Views
    jazzycamelJ

    @nullbuil7 said in how do i separate these sudoku boxes (grids):

    import sys
    from PySide2.QtWidgets import *
    from PySide2.QtGui import *

    class SudokuGrid(QWidget):
    def init(self):
    super(SudokuGrid, self).init()
    self.initGUI()

    def initGUI(self): self.setWindowTitle("Sudoku Grid Example") self.setGeometry(800, 800, 400, 350) self.setGrid() def setGrid(self): gridLayout = QGridLayout() box1 = QGridLayout() box2 = QGridLayout() box3 = QGridLayout() box4 = QGridLayout() box5 = QGridLayout() box6 = QGridLayout() box7 = QGridLayout() box8 = QGridLayout() box9 = QGridLayout() hline = QFrame() hline.setFrameShape(QFrame.HLine) hline.setFrameShadow(QFrame.Sunken) vline = QFrame() vline.setFrameShape(QFrame.VLine) vline.setFrameShadow(QFrame.Sunken) gridLayout.addLayout(box1,0,0) gridLayout.addWidget(vline, 0, 1) gridLayout.addLayout(box2,0,2) gridLayout.addWidget(vline, 0, 3) gridLayout.addLayout(box3,0,4) gridLayout.addWidget(hline, 1, 0, 1, 5) gridLayout.addLayout(box4,2,0) gridLayout.addWidget(vline, 2, 1) gridLayout.addLayout(box5,2,2) gridLayout.addWidget(vline, 2, 3) gridLayout.addLayout(box6,2,4) gridLayout.addWidget(hline, 3, 0, 1, 5) gridLayout.addLayout(box7,4,0) gridLayout.addWidget(vline, 4, 1) gridLayout.addLayout(box8,4,2) gridLayout.addWidget(vline, 4, 3) gridLayout.addLayout(box9,4,4) pos = [(0,0),(0,1),(0,2), (1,0),(1,1),(1,2), (2,0),(2,1),(2,2)] i = 0 while i < 9: box1.addWidget(QLabel("1", self), pos[i][0], pos[i][1]) box2.addWidget(QLabel("1", self), pos[i][0], pos[i][1]) box3.addWidget(QLabel("1", self), pos[i][0], pos[i][1]) box4.addWidget(QLabel("1", self), pos[i][0], pos[i][1]) box5.addWidget(QLabel("1", self), pos[i][0], pos[i][1]) box6.addWidget(QLabel("1", self), pos[i][0], pos[i][1]) box7.addWidget(QLabel("1", self), pos[i][0], pos[i][1]) box8.addWidget(QLabel("1", self), pos[i][0], pos[i][1]) box9.addWidget(QLabel("1", self), pos[i][0], pos[i][1]) i = i + 1 self.setLayout(gridLayout)

    if name == 'main':
    try:
    myApp = QApplication(sys.argv)
    myWindow = SudokuGrid()
    myWindow.show()
    myApp.exec_()
    sys.exit(0)
    except NameError:
    print("Name Error:", sys.exc_info()[1])
    except SystemExit:
    print("Closing Window...")
    except Exception:
    print(sys.exc_info()[1])

    Its not a bug in Qt or PySide2: you can't add a widget to a layout multiple times; you only create one each ofhline and vline and add them to multiple locations in your layout. See my example below where I create a new instance of hline and vline each time I use them (and tidied things up a bit):

    from PySide2.QtWidgets import QWidget, QGridLayout, QFrame, QLabel class SudokuGrid(QWidget): def __init__(self, parent=None, **kwargs): super().__init__(parent, **kwargs) self.setWindowTitle("Sudoku Grid Example") self.setGeometry(800,800,400,350) l=QGridLayout(self) boxes=[] for i in range(9): col=i%3 row=i//3 box=QGridLayout() boxes.append(box) l.addLayout(box, row*2, col*2) if col<2: vline=QFrame() vline.setFrameShape(QFrame.VLine) vline.setFrameShadow(QFrame.Sunken) l.addWidget(vline, row*2, (col*2)+1) if col==2 and row<2: hline=QFrame() hline.setFrameShape(QFrame.HLine) hline.setFrameShadow(QFrame.Sunken) l.addWidget(hline, (row*2)+1, 0, 1, 5) for box in boxes: for i in range(9): col=i%3 row=i//3 box.addWidget(QLabel(str(i),self), row, col) if __name__=="__main__": from sys import argv, exit from PyQt5.QtWidgets import QApplication a=QApplication(argv) s=SudokuGrid() s.show() exit(a.exec_())

    I've tested this with PyQt5 not PySide2, but they are compatible and this code should work perfectly well.

    Hope this helps ;o)