Skip to content

Language Bindings

You're using Qt with other languages than C++, eh? Post here!
853 Topics 3.3k Posts
  • Android Qt 5.1 and native code

    5
    0 Votes
    5 Posts
    4k Views
    A

    Anyway I need the inverse of JNI does...I need to use native java (admob) in Qt environment...

  • 0 Votes
    1 Posts
    2k Views
    No one has replied
  • PySide 1.2.0.win32 for python 3.2

    1
    0 Votes
    1 Posts
    802 Views
    No one has replied
  • 0 Votes
    1 Posts
    841 Views
    No one has replied
  • 0 Votes
    1 Posts
    2k Views
    No one has replied
  • Getting WebKitVersion in PySide

    1
    0 Votes
    1 Posts
    767 Views
    No one has replied
  • 0 Votes
    7 Posts
    3k Views
    H

    Ok this last one worked perfectly .. Thank you much

    lineEdit = QtGui.QLineEdit() lineEdit.setAlignment(QtCore.Qt.AlignRight) lineEdit.textChanged.connect( lambda: lineEdit.cursorBackward(False))
  • Find widget coordinates inside a layout

    2
    0 Votes
    2 Posts
    11k Views
    jazzycamelJ

    From what I understand you are trying to ascertain the (x,y) coordinate of the top left corner of the QLabel relative to the QLayout? If so, then you can use geometry().topLeft() on both the layout and the widget to get there global positions and then subtract the first from the second to get the relative position. The following example should demonstrate this. It's written with PyQt4 (I don't have a PySide install), but it should be trivial to to convert it:

    @
    from PyQt4.QtCore import *
    from PyQt4.QtGui import *

    class Widget(QWidget):
    def init(self, parent=None, **kwargs):
    QWidget.init(self, parent, **kwargs)

    self.resize(640,480) l=QHBoxLayout(self) self.l1=QVBoxLayout() self.label1=QLabel("QLabel<br />(centered)", self, alignment=Qt.AlignCenter) self.label1.setStyleSheet("border: 1px solid black;") self.label1.setFixedSize(100,50) self.l1.addWidget(self.label1, alignment=Qt.AlignCenter) l.addLayout(self.l1) self.l2=QVBoxLayout() self.label2=QLabel("QLabel<br />(centered)", self, alignment=Qt.AlignCenter) self.label2.setStyleSheet("border: 1px solid black;") self.label2.setFixedSize(100,50) self.l2.addWidget(self.label2, alignment=Qt.AlignCenter) l.addLayout(self.l2) fl=QFormLayout() self.label1pa=QLabel('0px', self) self.l1pa=QLabel('0px', self) self.label1pr=QLabel('0px', self) fl.addRow("Label 1 Position (absolute):", self.label1pa) fl.addRow("Layout 1 Position (absolute):", self.l1pa) fl.addRow("Label 1 Position (relative):", self.label1pr) self.label2pa=QLabel('0px', self) self.l2pa=QLabel('0px', self) self.label2pr=QLabel('0px', self) fl.addRow("Label 2 Position (absolute):", self.label2pa) fl.addRow("Layout 2 Position (absolute):", self.l2pa) fl.addRow("Label 2 Position (relative):", self.label2pr) l.addLayout(fl) def resizeEvent(self, event): QWidget.resizeEvent(self, event) label1pa=self.label1.geometry().topLeft() l1pa=self.l1.geometry().topLeft() label1pr=label1pa-l1pa self.label1pa.setText('({0},{1})px'.format(label1pa.x(), label1pa.y())) self.l1pa.setText('({0},{1})px'.format(l1pa.x(), l1pa.y())) self.label1pr.setText('({0},{1})px'.format(label1pr.x(), label1pr.y())) label2pa=self.label2.geometry().topLeft() l2pa=self.l2.geometry().topLeft() label2pr=label2pa-l2pa self.label2pa.setText('({0},{1})px'.format(label2pa.x(), label2pa.y())) self.l2pa.setText('({0},{1})px'.format(l2pa.x(), l2pa.y())) self.label2pr.setText('({0},{1})px'.format(label2pr.x(), label2pr.y()))

    if name=="main":
    from sys import argv, exit

    a=QApplication(argv) w=Widget() w.show() w.raise_() exit(a.exec_())

    @

    Hope this helps ;o)

  • 0 Votes
    1 Posts
    793 Views
    No one has replied
  • Dnd moveAction QabstractItemModel

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • 0 Votes
    6 Posts
    18k Views
    N

    I was missing these parts:

    @
    ...
    l=QVBoxLayout(self)
    l.setContentsMargins(0,0,0,0)
    ...
    l.addWidget(self.mainMenu)
    ...
    @

    Works :) ! Thanks so much!

  • Print QTextEdit and QGraphicsView as pdf(PtQT)

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • PySide on Windows crashes during install

    1
    0 Votes
    1 Posts
    779 Views
    No one has replied
  • 0 Votes
    3 Posts
    12k Views
    B

    From a user's point of view:

    In this case, word pairs with the same meaning:

    asynch/synch popup/exec non-modal/modal

    Modal: when a thing ( dialog or in this case a menu) causes the GUI to enter a state where the user can do nothing else (other modes) in that app until the thing is finished.

    With some variations: if the user clicks outside a modal menu, it is finished and returns a null result. Whereas in a modal dialog, the user must click in a Cancel button to finish the dialog, and can't click elsewhere in your app with any effect.

    And even when an app is in a modal state, the user might be able to click in the windows of other apps (usually, it depends on the window manager, etc.)

    From a programmer's point of view, your app event loop doesn't receive events when a modal dialog or menu is displayed. (Qt does receive and handle events, but doesn't dispatch them to your event loop.)

  • QtJambi and sqldrivers

    1
    0 Votes
    1 Posts
    843 Views
    No one has replied
  • [Solved] Application icon in PySide GUI

    3
    0 Votes
    3 Posts
    8k Views
    P

    I found another solution that doesn't require having the icon in both PNG and ICO formats. As mentioned in the other answer, qico4.dll is required to read the .ico files. Also, this file needs to be placed in a directory named imageformats that is a subdirectory of your app directory. The folder structure should look like this:

    @
    My Gui

    -- MyGui.exe -- QtCore4.dll -- QtGui4.dll -- ... -- imageformats -- qico4.dll

    @

    qico4.dll is installed with your PySide distribution. If you pick typical installation options the file should be under

    @
    os.path.join(os.path.dirname(sys.executable),
    'Lib',
    'site-packages',
    'PySide',
    'plugins',
    'imageformats' )
    @

  • 0 Votes
    1 Posts
    1k Views
    No one has replied
  • 0 Votes
    2 Posts
    2k Views
    B

    Did you solve your problem?

  • QRegExp

    Locked
    3
    0 Votes
    3 Posts
    961 Views
    K

    [quote author="SGaist" date="1370552782"]"Duplicate of":http://qt-project.org/forums/viewthread/28572/[/quote]
    closing

  • Pyside-rcc command line compression question

    2
    0 Votes
    2 Posts
    3k Views
    A

    Try the threshold flag. The argument is given as a percentage (0-100).

    I dug it up here:

    http://qt.gitorious.org/pyside/pyside-tools/blobs/master/pyrcc/rcc.cpp#line124

    The compression itself is done using the qCompress method of the QByteArray class, which is documented here:

    http://qt-project.org/doc/qt-4.8/qbytearray.html#qCompress