Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • always get key inputs from application (if app even not active)

    Unsolved
    5
    0 Votes
    5 Posts
    372 Views
    J
    @SimonSchroeder this Qt app seem to be working as I requested, I post later after tests https://github.com/Skycoder42/QHotkey
  • Widget for Toggle switch in pyside6

    Unsolved
    4
    0 Votes
    4 Posts
    3k Views
    SGaistS
    What you can do is use a stylesheet to customize the image used for your toggle. See customizing QCheckBox.
  • "Don't call QList::front() on a temporary" clazy warning, what is it about?

    Solved
    8
    0 Votes
    8 Posts
    2k Views
    Christian EhrlicherC
    @Violet-Giraffe said in "Don't call QList::front() on a temporary" clazy warning, what is it about?: calling front() can never create a copy of an std container. Yes because the copy occoured already before.
  • qDebug() with color

    Unsolved
    4
    1 Votes
    4 Posts
    1k Views
    JonBJ
    @Chris-Kawa said in qDebug() with color: For example Qt Creator Application Output supports ANSI escape sequences That I didn't know, I thought it was raw output.
  • is it possible to capture Windows Key using QKeyEvent and other related tools

    Unsolved
    3
    0 Votes
    3 Posts
    428 Views
    J
    @Pl45m4 I that 100% true? because shortcut is currently seen even if app is not active... [1] WIN key is big difference/issue for QT? [2] I need to get shortcuts if app windows is not active,
  • How to make expanding list with text like this

    Unsolved
    2
    0 Votes
    2 Posts
    193 Views
    Christian EhrlicherC
    This is a treeview - so QTreeView or QTreeWidget depending on your needs.
  • get asynchronous keys with Qt

    Unsolved
    7
    0 Votes
    7 Posts
    501 Views
    J
    @ChrisW67 I found solution, but it still blocks keyboard input when application is active solution: https://github.com/Skycoder42/QHotkey
  • How to debug with gdb code before return a.exec(), after gdb passed after a.exec() line

    Unsolved
    2
    0 Votes
    2 Posts
    227 Views
    Christian EhrlicherC
    Add your breakpoint inside your widget's code.
  • How to rename project

    Unsolved
    2
    0 Votes
    2 Posts
    238 Views
    SGaistS
    Hi, Close Qt Creator Rename the .pro file Edit the .pro file and update the target name Rename the project folder Open project with Qt Creator
  • Parse json string to QMap

    Unsolved
    14
    0 Votes
    14 Posts
    2k Views
    JonBJ
    @SGaist I know, I was agreeing with you :) No idea how much JSON data OP has to parse. They might read it in as QVariantMap and transform in code to some specific QMap<..., ...> if demanded. Not the fastest, but might be quickest if OP wants to write it. Integrating the code you referenced has its own overheads :)
  • This topic is deleted!

    Unsolved
    10
    0 Votes
    10 Posts
    48 Views
  • Qt6.4: how to record a renderd camera video

    Unsolved
    2
    1 Votes
    2 Posts
    370 Views
    L
    I am facing the same problem. I would like to use qvideosink as input for the recorder and not a qcamera since I have customized qvideframes
  • Issue with drag and drop

    Solved
    18
    0 Votes
    18 Posts
    3k Views
    JonBJ
    @Cobra91151 said in Issue with drag and drop: No need to change the registry values. I have found hack with Notepad (admin privileges) which allows to drap/drop files directly from Windows Explorer to my program with admin privileges LOL :)
  • Dialog layout spacing issue

    Solved
    5
    0 Votes
    5 Posts
    333 Views
    W
    @Christian-Ehrlicher Awesome, spacers did the trick! Thanks a lot!
  • Qt OpenGL rendering doesn't work

    Unsolved
    3
    0 Votes
    3 Posts
    490 Views
    SGaistS
    Here is a basic example that I hope will get you going: import sys from OpenGL import GL from PySide6.QtCore import QTimer from PySide6.QtGui import QMatrix4x4 from PySide6.QtGui import QOpenGLFunctions from PySide6.QtGui import QSurfaceFormat from PySide6.QtOpenGL import QOpenGLShader from PySide6.QtOpenGL import QOpenGLShaderProgram from PySide6.QtOpenGLWidgets import QOpenGLWidget from PySide6.QtWidgets import QApplication vertext_shader_source = """ attribute highp vec4 posAttr; attribute lowp vec4 colAttr; varying lowp vec4 col; uniform highp mat4 matrix; void main() { col = colAttr; gl_Position = matrix * posAttr; } """ fragment_shader_source = """ varying lowp vec4 col; void main() { gl_FragColor = col; } """ class OpenGLWidget(QOpenGLWidget): def __init__(self, parent=None): super().__init__(parent) self.gl = QOpenGLFunctions() self._animating = False self._posAttr = 0 self._colAttr = 0 self._matrix_uniform = 0 self._program = None self._frame = 0 self._timer = QTimer() self._timer.timeout.connect(self.update) def initializeGL(self): self.gl.initializeOpenGLFunctions() self._program = QOpenGLShaderProgram(self) success = self._program.addShaderFromSourceCode( QOpenGLShader.Vertex, vertext_shader_source ) assert success success = self._program.addShaderFromSourceCode( QOpenGLShader.Fragment, fragment_shader_source ) assert success success = self._program.link() assert success self._posAttr = self._program.attributeLocation("posAttr") assert self._posAttr != -1 self._colAttr = self._program.attributeLocation("colAttr") assert self._colAttr != -1 self._matrix_uniform = self._program.uniformLocation("matrix") assert self._matrix_uniform != -1 def paintGL(self): retinaScale = self.devicePixelRatio() self.gl.glViewport( 0, 0, self.width() * retinaScale, self.height() * retinaScale ) self.gl.glClear(GL.GL_COLOR_BUFFER_BIT) self._program.bind() matrix = QMatrix4x4() matrix.perspective(60.0, 4.0 / 3.0, 0.1, 100.0) matrix.translate(0, 0, -2) matrix.rotate(100.0 * self._frame / self.screen().refreshRate(), 0, 1, 0) self._program.setUniformValue(self._matrix_uniform, matrix) vertices = [0.0, 0.707, -0.5, -0.5, 0.5, -0.5] colors = [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0] GL.glVertexAttribPointer( self._posAttr, 2, GL.GL_FLOAT, GL.GL_FALSE, 0, vertices ) GL.glVertexAttribPointer(self._colAttr, 3, GL.GL_FLOAT, GL.GL_FALSE, 0, colors) self.gl.glEnableVertexAttribArray(self._posAttr) self.gl.glEnableVertexAttribArray(self._colAttr) self.gl.glDrawArrays(GL.GL_TRIANGLES, 0, 3) self.gl.glDisableVertexAttribArray(self._colAttr) self.gl.glDisableVertexAttribArray(self._posAttr) self._program.release() self._frame += 1 def setAnimating(self, animating: bool): self._animating = animating if animating: self._timer.start(25) if __name__ == "__main__": app = QApplication(sys.argv) format = QSurfaceFormat() format.setSamples(16) QSurfaceFormat.setDefaultFormat(format) widget = OpenGLWidget() widget.setAnimating(True) widget.show() sys.exit(app.exec())
  • How to add to project QtCore and QtGui

    Unsolved
    2
    0 Votes
    2 Posts
    209 Views
    Christian EhrlicherC
    Since you're using qmake you have to adjust the QT variable: QT += core gui widgets
  • QPrinter how to print without margin

    Unsolved
    5
    0 Votes
    5 Posts
    688 Views
    S
    About the deprecation it's after Qt 5.15 on QPrinter's methods pageRect and paperRect. About the zeros, I have retry, I think it's an error. Please ignore my previous comment. I've no time now to retry, but I will do that later. Thank's.
  • how to install Qt6 (latest) for ubuntu 22 (Jammy Fish)

    Solved
    9
    0 Votes
    9 Posts
    59k Views
    J
    @JacobNovitsky ./qt-unified-linux-x64-4.3.0-1-online.run --mirror https://mirrors.ocf.berkeley.edu/qt
  • Bugs when app runs with Qt Creator and ubuntu

    Unsolved
    5
    0 Votes
    5 Posts
    396 Views
    SGaistS
    You did not answer my first question. Also, which version of Qt creator are you using ?
  • Resize the window by dragging but it with obvious shadows

    Unsolved
    7
    0 Votes
    7 Posts
    423 Views
    zybzybZ
    @Pl45m4 use QPalette