Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.7k Topics 457.9k Posts
  • qt mathematical expression

    Solved
    4
    0 Votes
    4 Posts
    402 Views
    JoeCFDJ
    @VRonin Good one. Thanks.
  • pixmap resize

    Solved
    3
    0 Votes
    3 Posts
    354 Views
    JoeCFDJ
    you generate svg image to fit the full screen without losing resolution. Do not create pixmap. https://doc.qt.io/qt-5/qtsvg-svggenerator-example.html
  • Q3DSurface selected point signal

    Unsolved
    2
    1 Votes
    2 Posts
    495 Views
    H
    Although this topic is quite old, you were on the right track. The selectedPointChanged(const QPoint &position) signal provides the position of the selected point in your QtDataVisualization::QSurfaceDataProxy, which can be used to access the desired information by using QtDataVisualization::QSurfaceDataProxy::itemAt(const QPoint &position). Below a minimalistic outline of the basic steps: using namespace QtDataVisualization; ... # surface init (should already exist) Q3DSurface *surfacePlot = new Q3DSurface(); QSurfaceDataProxy *surfaceDataProxy = new QSurfaceDataProxy(); QSurface3DSeries *surfaceDataSeries = new QSurface3DSeries(surfaceDataProxy); surfacePlot->addSeries(surfaceDataSeries); # connect the selectedPointChanged signal to e.g. your desired foo function # (adjust this to fit the required signal/slot type for your function) QObject::connect(surfaceDataSeries, &QSurface3DSeries::selectedPointChanged, foo); # the foo funciton should look like void foo(const QPoint &position) { if ((position.x() < 0) or (position.y() < 0)) return; // nothing selected QVector3D pos = surfaceDataProxy->itemAt(position)->position(); // (x,y,z) data for selected point ... # e.g. store the pos in some list }
  • Half-open QTcpSocket

    2
    0 Votes
    2 Posts
    865 Views
    A
    @PLuS said in Half-open QTcpSocket: I'm working with QTcpServer and QTcpSocket for making a server on the other side there is a client written in C, which calls shutdown(socket, SHUT_WR) after writing request, so it only expects data from server but when client calls shutdown function, I get RemoteHostClosedError and cannot write anything to Client (although isWritable returns true) is there any workaround? I am also in the same situation. I'll share solution soon.
  • Hide QPushButton in release build and show it in debug mode

    Solved debug release qpushbutton
    3
    0 Votes
    3 Posts
    744 Views
    S
    Thanks for this hint. Very useful for debugging purposes. Appreciate the help :)
  • Fetching current json adding to it and storing it back in the file

    Solved
    18
    0 Votes
    18 Posts
    1k Views
    K
    The complete answer :) bool DeviceData::devicedataupdated() { QFile deviceListFile(_JsonFile); if( !deviceListFile.open( QIODevice::ReadOnly | QIODevice::Text ) ) { return false; } QJsonDocument jsonOrg = QJsonDocument::fromJson( deviceListFile.readAll() ); deviceListFile.close(); if ( deviceListFile.open( QIODevice::WriteOnly | QIODevice::Text ) ) { QJsonObject newDevice; newDevice.insert( "IPA", "newdevice" ); newDevice.insert( "Icon", "fa_bolt" ); newDevice.insert( "Name", "New Device" ); newDevice.insert( "Status", "online" ); newDevice.insert( "Type", "Strip" ); newDevice.insert( "UVLights", "false" ); auto top = jsonOrg.object(); auto devices = top.value( "Device" ).toArray(); devices.push_back( newDevice ); top.insert("Device", devices); QJsonDocument jsonDoc( top ); deviceListFile.write( jsonDoc.toJson() ); deviceListFile.close(); return true; } return false; }
  • Writing to a CSV file - can we add colour to a cell?

    Unsolved
    11
    0 Votes
    11 Posts
    1k Views
    A
    @JonB Thanks. It is not going to be worth the hassle this time but all good info for the future.
  • Stop a signal from firing from code!

    Solved
    8
    0 Votes
    8 Posts
    599 Views
    VRoninV
    For people ending up here from Google: If you want a signal to be sent only when the user edits the cell and not when it's done by internal processes the correct way is a simple custom delegate: class EditSignalDelegate : public QStyledItemDelegate { Q_OBJECT public: using QStyledItemDelegate::QStyledItemDelegate ; void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override { QStyledItemDelegate::setModelData(editor,model,index); indexEdited(index); } signals: void indexEdited(const QModelIndex &index); }; Now you can use EditSignalDelegate* delegate = new EditSignalDelegate(this); connect(delegate,&EditSignalDelegate::indexEdited,this,[](const QModelIndex &index){qDebug() << "cell edited " << index.row() << "," <<index.column();}); ui->tableWidgetDeviceList->setItemDelegate(delegate);
  • Qt6.1.2 static + MSVS2019 + Extension Qt Visual Studio Tools 2.7.1.20

    Unsolved
    2
    0 Votes
    2 Posts
    298 Views
    VRoninV
    Qt6.1.2 static How did you compile it? are you sure you built it for 64 bit architecture?
  • WebSocket Implementation to existing project

    Unsolved
    1
    0 Votes
    1 Posts
    123 Views
    No one has replied
  • Websockets not locally

    websocket
    2
    0 Votes
    2 Posts
    756 Views
    J
    Hi, have you been able to find a solution to this issue? i have been wacking my brain around this websocket thing for a few weeks now, and i just cant get it to work, i have fingured out how i can send the data using the Webchannel standalone example and how i can use it to display my sensor data on the web browser. but it doesnt meet the requirements of my project. the problem is the HTML file is basically being opened from the local storage, i want to be able to connect to the html page using a localhost:port option. and the documentation on this is to vague for a neewbi to qt to be able to understand and work with. i would really appreciate any help
  • DeepL API???

    Unsolved
    2
    0 Votes
    2 Posts
    439 Views
    sierdzioS
    It's probably good for a first draft but a review from professional translator will be necessary.
  • linker error while building 'QtCipherSqlitePlugin' with Qt 5.6.2 msvc 2013 32bit

    Unsolved
    1
    0 Votes
    1 Posts
    128 Views
    No one has replied
  • 0 Votes
    4 Posts
    371 Views
    C
    @Carlos-Delfino "Is it possible to transform SVG files with QT programmatically?" SVG is just XML, so you can read and do whatever you like to the XML using the generic XML classes in Qt. Depending on the transform, you may be be able to use XSLT with the (deprecated) Xml Patterns module or a third-party library. So, if your "template" AND-gate SVG has identifiable points to insert input nodes and sizes (does SVG support a scaled sub-block?) for the gate symbol then it should be doable. Neither of these is going to dynamically change the displayed form of the SVG, or change any on-screen interaction (e.g. drag-n-drop to connect to the dynamically created points). As @JoeCFD suggests, QGraphicsView might be a better fit.
  • Qt Creator setup on Ubuntu 20.04 LTS

    Solved
    2
    0 Votes
    2 Posts
    4k Views
    D
    After additionally installing these dependencies: sudo apt install qt5-doc qt5-doc-html qtbase5-doc-html the examples appeared. To get some desktop examples to build, I also had to install these: sudo apt install cmake clang-8 libclang1-8 and then make sure that the qt-version and cmake-tool were set in Tools > Options > Kits Edit: I ended up selecting /usr/lib/qt5/bin/qmake (I think the other qmake scripts would also work), the "no qmlscene installed" message is still present, but doesn't seem to be a problem.
  • Couldn't rebuild my older project

    Solved
    2
    0 Votes
    2 Posts
    147 Views
    L
    I figured out the problem, it was caused by my file path name being too long. It worked when I shortened the folder name.
  • Is it possible to develop a GUI using external libraries like Pytest?

    Unsolved
    2
    0 Votes
    2 Posts
    220 Views
    eyllanescE
    @Tonyvazquezzz Yes, it is possible.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    11 Views
    No one has replied
  • How to get qmake to support assembly language?

    Unsolved
    4
    0 Votes
    4 Posts
    455 Views
    P
    OK thanks, here's what I found works: ASM_FILES += myfile.asm ASMEXTRAFLAGS = -march=armv8-a QMAKE_EXTRA_TARGETS += myfile.o asm.output = ${QMAKE_FILE_BASE}.o asm.commands = as $$ASMEXTRAFLAGS -o ${QMAKE_FILE_BASE}.o ${QMAKE_FILE_NAME} asm.input = ASM_FILES QMAKE_EXTRA_COMPILERS += asm
  • Rotate a QLine

    Unsolved
    9
    0 Votes
    9 Posts
    1k Views
    S
    Hi, thanks for the response. That was not what I was looking for, but I found another way. I used QGraphicsScene.