Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.6k Posts
  • Inheriting without Inheriting the Ui, how?

    Solved
    4
    0 Votes
    4 Posts
    340 Views
    S
    Yeah, I think that's what I got to do.
  • How to set vertical QProgressBar width ?

    Solved
    2
    0 Votes
    2 Posts
    168 Views
    Pl45m4P
    @sonichy The easiest way is to use Stylesheet https://doc.qt.io/qt-6/stylesheet-examples.html#customizing-qprogressbar
  • Cannot find Oracle::OCI when using statically built Qt

    Unsolved
    9
    0 Votes
    9 Posts
    857 Views
    Y
    @SGaist Hi, the following CMakeLists.txt is minimal, just add sql module in find_package() and target_link_libraries() based on the default CMakeLists.txt template of Qt Creator cmake_minimum_required(VERSION 3.16) project(QtTest VERSION 0.1 LANGUAGES CXX) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Qt6 6.5 REQUIRED COMPONENTS Quick Sql) qt_standard_project_setup(REQUIRES 6.5) qt_add_executable(appQtTest main.cpp ) qt_add_qml_module(appQtTest URI QtTest VERSION 1.0 QML_FILES Main.qml ) # Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1. # If you are developing for iOS or macOS you should consider setting an # explicit, fixed bundle identifier manually though. set_target_properties(appQtTest PROPERTIES # MACOSX_BUNDLE_GUI_IDENTIFIER com.example.appQtTest MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} MACOSX_BUNDLE TRUE WIN32_EXECUTABLE TRUE ) target_link_libraries(appQtTest PRIVATE Qt6::Quick Qt6::Sql ) include(GNUInstallDirs) install(TARGETS appQtTest BUNDLE DESTINATION . LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )
  • Can't init repository for Qt 6.8.1

    Unsolved
    2
    0 Votes
    2 Posts
    283 Views
    SGaistS
    Hi, Likely a network issue, did you try again in between ?
  • QSocketNotifier: socket notifiers cannot be enabled from another thread

    Unsolved
    8
    0 Votes
    8 Posts
    714 Views
    JonBJ
    @bxrs What "while" loop? You won't have one. No blocking, no waiting! The asynchronous way of doing things is: send your data to device, put a slot on readyRead(), accumulate whatever is received into a (member variable, so it persists) buffer (you must not assume one call will receive 1024 bytes or whatever, Qt only guarantees you will get 1 or more bytes when readyRead() is called), check to see if 1024 bytes or whatever for a "complete message". If so, remove the 1024/message bytes from the "pending" buffer, emit your own signal (like messageReceived(bytes)) with that data, attach a slot to do whatever on completed signal. That is how we do asynchronous stuff without blocking or using a thread.
  • qt6 qt creator acceptTouchEvents on x11 ubuntu

    Solved
    19
    0 Votes
    19 Posts
    2k Views
    gfxxG
    seems real solution is to obligate QT6 to use Xinput2 install by default on modern ubuntu/mint SO. For these you must use "qputenv" command in your main. The exact command can share more late ... not remember and not avaiable now. ..... update ... THE MAGIC ROW !!!! qputenv("QT_XCB_NO_XI2", "0"); // Ensure Qt uses XInput2 for touch input
  • How to find Directory Size?

    Unsolved
    5
    0 Votes
    5 Posts
    4k Views
    7
    Hi @helsouri ! Take a look at usages here https://doc.qt.io/qt-6/qdiriterator.html They told After construction, the iterator is located before the first directory entry So the proper code is QDirIterator it("c:/vlc", QDirIterator::Subdirectories); qint64 total = 0; while (it.hasNext()) { it.next(); // check if entry is file if(it.fileInfo().isFile()) { total += it.fileInfo().size(); } } qDebug() << "size" << total;
  • Why does QProcess fail to open the shortcut key exe?

    Solved
    4
    0 Votes
    4 Posts
    323 Views
    JonBJ
    @mirro I thought Windows requires that shortcuts end in .lnk, but apparently not? What happens if you try to launch that shortcut by typing in its full path directly into Command Prompt? Depending on that, maybe Windows requires shortcuts to be launched/invoked through its shell wrapper?
  • Problem with loading resources from qrc file

    Unsolved
    5
    0 Votes
    5 Posts
    426 Views
    C
    @SirMarcin As Bonnie says. I had this problem while doing a course at least a year ago now. It turned out that the template was incomplete for the version of Qt I had installed. The previous version worked fine so I was able to copy the template from an older version and then it all worked.
  • border-color property does not work on custom stylesheet

    Unsolved
    4
    0 Votes
    4 Posts
    395 Views
    M
    @Bonnie said in border-color property does not work on custom stylesheet: @Mark81 You need to write the full border style: You're right. I didn't understand this from the docs! Out of curiosity, to test the Light style I added this line: QGuiApplication::styleHints()->setColorScheme(Qt::ColorScheme::Light); but the theme is still dark (as per my system settings). The docs (here) state I can set an explicit color scheme. Is there anything else I should set? I'm aware it is slightly offtopic, but it is useful to test the stylesheet in different scenarios.
  • This topic is deleted!

    Unsolved
    2
    0 Votes
    2 Posts
    61 Views
  • How to install compiler that is native ARM but emits Intel instructions?

    Unsolved
    8
    0 Votes
    8 Posts
    958 Views
    D
    does anyone have any advice here?
  • Widgets (Drawn with QPaintEvent / QPainter) Randomly Stop Updating

    Unsolved
    4
    0 Votes
    4 Posts
    377 Views
    Axel SpoerlA
    I think it's worth to bite the bullet. If it's really a bug in Qt (which I actually doubt), it's fairly unlikely that it will be fixed in 5.15. That's different for Qt 6 though.
  • Got VNC platform plugin working on Qt 5

    vnc qt 5
    11
    1 Votes
    11 Posts
    19k Views
    M
    For those who find this via web search, the port can be set via a … drum roll … port=INTEGER parameter, as in #!/bin/sh export QT_QPA_PLATFORM=vnc:size=480x300:addr=127.0.0.1:port=$(expr 5900 + ${SCREEN:-1}) export QT_PLUGIN_PATH=/usr/lib/qt/plugins here="$(dirname "$0")" exec "${here}"/gui.real
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    14 Views
    No one has replied
  • how to make the tablewidget cost less time?

    Unsolved
    5
    0 Votes
    5 Posts
    462 Views
    S
    For a QTableWidget you have to create the widget for every cell in the table view. This can take quite some time (depending on the number of rows and columns). The QTableView manages the individual widgets for the cells differently. Simply speaking, it just shows the widgets that are visible and reuses them when scrolling. This is why QTableView is the better choice for a lot of data. However, you are saying that you have only 100 rows. If it is only a hand full of columns 2 seconds might be a little long (though 100 rows by 10 columns would already be 1000 widgets). Do you have a single call to the database to fetch the data? Or are you querying one row at a time?
  • QSortFilterProxyModel subclass returns undefined records

    Unsolved qsortfilterprox model
    1
    0 Votes
    1 Posts
    199 Views
    No one has replied
  • Assert in QSortfilterproxymodel

    Solved
    5
    0 Votes
    5 Posts
    764 Views
    D
    Ive hit the same problem again while building new system. The solution is... beginInsertColumns(QModelIndex(), 0, labels.size() - 1); endInsertColumns();
  • How to implement smoothly updating map in Qt Widgets app?

    Solved
    4
    0 Votes
    4 Posts
    632 Views
    I
    @IgKh I used this method and it worked as needed: def update_map(self, new_coords: tuple[float, float]): self.folium_map.location = new_coords # keep it for next calculation because JavaScript doesn't update it map_name = self.folium_map.get_name() js_code = f'{map_name}.setView({list(new_coords)})' # Use `list()` because JS needs `[ ]` instead of `( )` self.page().runJavaScript(js_code) Thanks for the answer.
  • class QList<QString> has no member named 'emplace_back'

    Solved
    4
    0 Votes
    4 Posts
    483 Views
    M
    Ok I fixed it somehow in CMakeLists. CMakeLists.txt had find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets) I removed Qt5 from there set(PROJECT_SOURCES did NOT have the files I had added while building the program. They were being added later in the else-clause in cmake logic so I added the missing ones to PROJECT_SOURCES. The code below was the situation before the fix set(PROJECT_SOURCES main.cpp mainwindow.cpp mainwindow.h mainwindow.ui ) if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) qt_add_executable(Gridlink MANUAL_FINALIZATION ${PROJECT_SOURCES} ) # Define target properties for Android with Qt 6 as: # set_property(TARGET Gridlink APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR # ${CMAKE_CURRENT_SOURCE_DIR}/android) # For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation else() if(ANDROID) add_library(Gridlink SHARED ${PROJECT_SOURCES} ) # Define properties for Android with Qt 5 after find_package() calls as: # set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android") else() add_executable(Gridlink ${PROJECT_SOURCES} searchview.h searchview.cpp searchview.ui mpd_communication.h mpd_communication.cpp libraryview.h libraryview.cpp libraryview.ui artistview.h artistview.cpp artistview.ui albumview.h albumview.cpp albumview.ui datahandler.h datahandler.cpp config.h config.cpp song.h song.cpp album.h album.cpp ) endif() endif()