Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • QMQTT Client stuck connecting.

    Unsolved
    5
    0 Votes
    5 Posts
    729 Views
    Pablo J. RoginaP
    @RFinchMinicam said in QMQTT Client stuck connecting.: I've not used QT before You may want to take a look and try this client example. You'll see there are no infinite loops but the usage of Qt's signals & slots instead.
  • QHBoxLayout not working properly

    Unsolved
    4
    0 Votes
    4 Posts
    316 Views
    SGaistS
    Hi, @Batyu said in QHBoxLayout not working properly: m_HBoxLayout = new QHBoxLayout(parent); m_VBoxLayout = new QVBoxLayout(parent); Passing a parent to a layout automatically applies the layout to the parent.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    4 Views
    No one has replied
  • QNetworkReply readAll() gets empty data on finished()

    25
    0 Votes
    25 Posts
    23k Views
    JKSHJ
    Welcome, and thanks for sharing your solution! @Taras-Ertl said in QNetworkReply readAll() gets empty data on finished(): So it seems like it is not possible for qDebug() to print the data. There seems to be a limit to the amount of text that can be printed to Qt Creator's "Application Output" panel. If you try to print too much text to qDebug at once, nothing will appear (I'm not sure if this is a bug or not). Your workaround of printing to a text file instead is good.
  • OpenGL where to start?

    Unsolved
    7
    0 Votes
    7 Posts
    745 Views
    8Observer88
    I used this lesson: https://learnopengl.com/Advanced-OpenGL/Stencil-testing to make this demo for windows in Qt OpenGL 3.3: SelectObjectByClick_OpenGL33_Qt5Cpp.zip [image: select-by-click.gif]
  • Using QTextStream leads to memory leak

    Solved
    12
    0 Votes
    12 Posts
    1k Views
    JamshidJ
    Hi Thanks @jsulm , @Bonnie , @JonB , @mranger90 I solved the problem this way: QVector<QTextStream*> textStreamList_rdu_1; **** QTextStream *out = textStreamList_rdu_1[filesIDList_rdu_1.indexOf(char(ID))]; (*out) << QDateTime::currentDateTime().toString("hh:mm:ss.zzz ") + frame + "Switch_IP:" + IP + " " + logType << &Qt::endl(*out); *** // Close files and delete pointers for(int i = 0; i < fileList_rdu_1.size(); i++) { fileList_rdu_1[i]->close(); delete textStreamList_rdu_1[i]; } // fileList_rdu_1.clear(); textStreamList_rdu_1.clear(); The main problem was when the opened file not closed immediately, the memory started to increase! was so strange.
  • QSurfaceFormat does not allow to draw with OpenGL

    Solved
    5
    0 Votes
    5 Posts
    348 Views
    8Observer88
    I found my stupid mistake. I just forgot to get a uniform location for uMvpMatrix: m_uMvpMatrixLocation = m_program.uniformLocation("uMvpMatrix"); main.cpp // Add this line to .pro: // win32: LIBS += -lopengl32 #ifdef _WIN32 #include <windows.h> extern "C" __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; extern "C" __declspec(dllexport) DWORD AmdPowerXpressRequestHighPerformance = 0x00000001; #endif #include <QtWidgets/QApplication> #include <QtWidgets/QOpenGLWidget> #include <QtGui/QOpenGLShaderProgram> #include <QtGui/QOpenGLBuffer> #include <QtGui/QMatrix4x4> #include <QtGui/QSurfaceFormat> class Widget : public QOpenGLWidget { Q_OBJECT public: Widget() { setWindowTitle("Rectangle. Qt, OpenGL 3.3, C++"); setFixedSize(QSize(400, 400)); resize(400, 400); } private: QOpenGLShaderProgram m_program; QOpenGLBuffer m_vertPosBuffer; QOpenGLBuffer m_texCoordBuffer; QMatrix4x4 m_mvpMatrix; QMatrix4x4 m_projMatrix; QMatrix4x4 m_viewMatrix; QMatrix4x4 m_modelMatrix; int m_uMvpMatrixLocation; void initializeGL() override { glClearColor(0.5f, 0.5f, 0.5f, 1.0f); glEnable(GL_DEPTH_TEST); const char *vertShaderSrc = "#version 330\n" "in vec3 aPosition;" "uniform mat4 uMvpMatrix;" "void main()" "{" " gl_Position = uMvpMatrix * vec4(aPosition, 1.0);" "}"; const char *fragShaderSrc = "#version 330\n" "out vec4 fragColor;" "void main()" "{" " fragColor = vec4(0.9, 0.9, 1.0, 1.0);" "}"; m_program.addShaderFromSourceCode(QOpenGLShader::Vertex, vertShaderSrc); m_program.addShaderFromSourceCode(QOpenGLShader::Fragment, fragShaderSrc); m_program.link(); m_program.bind(); m_uMvpMatrixLocation = m_program.uniformLocation("uMvpMatrix"); float vertPositions[] = { -0.5f, -0.5f, 0.f, 0.5f, -0.5f, 0.f, -0.5f, 0.5f, 0.f, 0.5f, 0.5f, 0.f }; m_vertPosBuffer.create(); m_vertPosBuffer.bind(); m_vertPosBuffer.allocate(vertPositions, sizeof(vertPositions)); m_program.bindAttributeLocation("aPosition", 0); m_program.setAttributeBuffer(0, GL_FLOAT, 0, 3); m_program.enableAttributeArray(0); m_viewMatrix.lookAt(QVector3D(0.f, 0.f, 50.f), QVector3D(0.f, 0.f, 0.f), QVector3D(0.f, 1.f, 0.f)); m_modelMatrix.translate(QVector3D(0.f, 0.f, 0.f)); m_modelMatrix.rotate(20.f, QVector3D(0.f, 0.f, 1.f)); m_modelMatrix.scale(50.f, 70.f, 1.f); } void paintGL() override { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); m_mvpMatrix = m_projMatrix * m_viewMatrix * m_modelMatrix; m_program.bind(); m_program.setUniformValue(m_uMvpMatrixLocation, m_mvpMatrix); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); } void resizeGL(int w, int h) override { glViewport(0, 0, w, h); m_projMatrix.setToIdentity(); m_projMatrix.ortho(-100.f, 100.f, -100.f, 100.f, 100.f, -100.f); } }; #include "main.moc" int main(int argc, char *argv[]) { QApplication a(argc, argv); QSurfaceFormat format; format.setSamples(8); Widget w; w.setFormat(format); QSurfaceFormat::setDefaultFormat(format); w.show(); return a.exec(); }
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    4 Views
    No one has replied
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • msvc2015 versus (2017 & 2019)

    Unsolved
    2
    0 Votes
    2 Posts
    221 Views
    SGaistS
    Hi, Bug fixes, improved C++ standard support (C++11 and later) and that kind of stuff. Are you mixing dlls built with different versions of the compiler ?
  • How to add Qt Bluetooth module to CMake?

    Solved
    9
    0 Votes
    9 Posts
    6k Views
    S
    i know this is an old thread but I am replying for any body in future searching for it add the following to your cmake file target_link_libraries(project PRIVATE Qt5::Core Qt5::Quick Qt5::Bluetooth )
  • How to add QWidget to QTextEdit?

    Moved Unsolved
    4
    0 Votes
    4 Posts
    774 Views
    JonBJ
    @AnneRanch said in How to add QWidget to QTextEdit?: YES I want to modify the hierarchy WITHOUT destroying the current child window class. I know. You can keep the class which is derived from QTextEdit if it does something for you. What you cannot do is make that the direct child widget of the QMdiSubWindow IF you want to put some more widgets on the window. Which I think is what you are wanting to do. If you want multiple widgets on a QMdiSubWindow, you need to make its child a Generic QWidget, add a layout to it, and then add whatever widgets you want there (including your QTextEdit). But as long as you keep the QLineEdit as the QMdiSubWindow's widget you're not set up to then add any further widgets.
  • SVG file in QGraphicsView

    Solved
    13
    0 Votes
    13 Posts
    2k Views
    S
    Hi, so I solved it by doing "ui->graphicsView_LeftHand->scene()->removeItem(svgLeftDark);" and then adding the other svg. So it's like this: QGraphicsScene *sceneLeft = new QGraphicsScene(this); ui->graphicsView_LeftHand->setScene(sceneLeft); QGraphicsSvgItem *add = new QGraphicsSvgItem("path/to/svg.svg"); QGraphicsSvgItem *remove = new QGraphicsSvgItem("path/to/svg.svg"); ui->graphicsView_LeftHand->scene()->removeItem(remove); //remove the svg that you don't want ui->graphicsView_LeftHand->scene()->addItem(add); //add the svg that you want If you want to have it across different voids, just add this at the top of the .cpp file (where you declare cross void variables, ...): QGraphicsSvgItem *add = new QGraphicsSvgItem("path/to/svg.svg"); QGraphicsSvgItem *remove = new QGraphicsSvgItem("path/to/svg.svg");
  • QPushButton icon disable pixel algorithm

    Solved
    4
    0 Votes
    4 Posts
    428 Views
    Christian EhrlicherC
    @Leon-Zhang said in QPushButton icon disable pixel algorithm: Could you please tell me where I can find https://duckduckgo.com/?t=ffsb&q=qt+source+code&ia=web
  • 0 Votes
    1 Posts
    144 Views
    No one has replied
  • frozen column cursor when editing

    Unsolved
    2
    0 Votes
    2 Posts
    142 Views
    S
    I think i'm just gonna make 2 different tableviews, both associated to the same model data. If i place them side by side, hide all columns except for col 0 for the left table, and hide col 0 for the right table it looks pretty good. Connecting the vertical scrollbars makes the functionality nice, and hiding the scrollbars on the left table makes for even nicer look. There's still a slight border between the two that is noticeable if the table is larger than the row data from the model, but whatevs at this point. At least this venture of trying to freeze a column lead forced me to understand better the model/view ecosystem.
  • How to disable keyboard?

    Moved Unsolved
    2
    0 Votes
    2 Posts
    187 Views
    M
    I'm not fully understanding what you want to do, but since your MdiChild class is derived from QTextEdit, you can call the QTextEdit:setReadOnly() method; passing it a value of true. child->setReadOnly(true);
  • Checking formatting of selected text in QTextEdit - PySide6

    Solved
    11
    0 Votes
    11 Posts
    1k Views
    T
    @SGaist Noted. Thanks again.
  • Render OpenGL texture inside Qt's interface

    Unsolved
    7
    0 Votes
    7 Posts
    1k Views
    SGaistS
    That's the kind of case where you would use moving window and a pixmap cache to limit the amount of image loaded at a time.
  • Unable to build OCI plugin

    Unsolved
    5
    0 Votes
    5 Posts
    400 Views
    SGaistS
    Hi, Additionally to @jsulm, you first need download the Qt sources. Currently you are running that in your Qt installation.