Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.5k Posts
  • Line edit for QListWidgetItem?

    Solved qlistwidgetitem qlineedit
    6
    0 Votes
    6 Posts
    1k Views
    Pl45m4P
    @CJha https://stackoverflow.com/questions/26614678/validating-user-input-in-a-qtableview (will work for every model/view, I think) Here you go :)
  • Weird memory leak on linux

    Unsolved
    11
    0 Votes
    11 Posts
    857 Views
    Kent-DorfmanK
    I'm not sure what the backing of MemoryFile looks like. It is probably implemented differently between windoze and linux. Typically in the posix world files are mmap() to virtual memory space when accessed so that only needed pages are in real memory when needed, but all pages are continugously addressable to the process memory map. Perhaps this mechanism isn't being used effectively in the linux Qt implementation?
  • Styling scrollbar with CSS

    Solved
    3
    0 Votes
    3 Posts
    1k Views
    T
    Thanks for the answer! the groove doesn't belong there anyway, and was deleted. I just "played" with it to see what kind of effects it had. I found the problem myself: Another global widget's properties were interfering with my scrollbar's.
  • paintEvent() cease to function?

    Solved
    4
    0 Votes
    4 Posts
    419 Views
    jsulmJ
    @BrianL said in paintEvent() cease to function?: so I guess I should avoid calling any Qt class functions on other threads Not in general. What is not supported is to change UI stuff from other threads than GUI thread. And that was exactly what you was doing.
  • is it possible to append stylesheet into existing stylesheet?

    Solved
    2
    0 Votes
    2 Posts
    957 Views
    Pl45m4P
    @saeid0034 said in is it possible to append stylesheet into existing stylesheet?: it will be replaced with the new stylesheet? The function to set a stylesheet explicitly is called setStylesheet... It sets the given style... previous styles (style changes) are lost. But there are inherited styles (cascading by parent). Read here: https://doc.qt.io/qt-5/stylesheet-syntax.html#cascading and here: https://doc.qt.io/qt-5/stylesheet-syntax.html#inheritance
  • Back to the past - using "bluez" library directly in QT

    Unsolved
    12
    0 Votes
    12 Posts
    922 Views
    C
    People in the thread have been trying to discuss some facts and help with education. Here is some further education. The <bluetooth/bluetooth.h> includes, and the corresponding library link, libbluetooth.so, for Linux Bluetooth development are part of the Ubuntu libbluetooth-dev package. A very simple example program is (basic C code from here): #include <QCoreApplication> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/socket.h> #include <bluetooth/bluetooth.h> #include <bluetooth/hci.h> #include <bluetooth/hci_lib.h> int main(int argc, char **argv) { QCoreApplication app(argc, argv); inquiry_info *ii = NULL; int max_rsp, num_rsp; int dev_id, sock, len, flags; int i; char addr[19] = { 0 }; char name[248] = { 0 }; dev_id = hci_get_route(NULL); sock = hci_open_dev( dev_id ); if (dev_id < 0 || sock < 0) { perror("opening socket"); exit(1); } len = 8; max_rsp = 255; flags = IREQ_CACHE_FLUSH; ii = (inquiry_info*)malloc(max_rsp * sizeof(inquiry_info)); num_rsp = hci_inquiry(dev_id, len, max_rsp, NULL, &ii, flags); if( num_rsp < 0 ) perror("hci_inquiry"); for (i = 0; i < num_rsp; i++) { ba2str(&(ii+i)->bdaddr, addr); memset(name, 0, sizeof(name)); if (hci_read_remote_name(sock, &(ii+i)->bdaddr, sizeof(name), name, 0) < 0) strcpy(name, "[unknown]"); printf("%s %s\n", addr, name); } free( ii ); close( sock ); return 0; } and a minimal Qt project file (test.pro) that will compile and link it: TEMPLATE = app TARGET = test INCLUDEPATH += . SOURCES += main.cpp LIBS += -lbluetooth The libbluetooth-dev package puts everything in standard paths so: No need to add search locations to INCLUDEPATH so the compiler can find the header files No need to add search locations to LIBS with -L options The only thing required to link is the name of a library to connect with the application, in this case the bluetooth library identified in the LIBS variable -lbluetooth. For libraries in Linux there is often a pkg-config file that can be queried (it is confusingly named in this case): # Things you may need to add the INCLUDEPATH or CFLAGS (for the compiler) $ pkg-config --cflags bluez # Things you need to consider for LIBS (for the linker) $ pkg-config --libs bluez -lbluetooth You can even ask Qt to use pkg-config directly to set INCLUDEPATH and LIBS internally: TEMPLATE = app TARGET = test INCLUDEPATH += . SOURCES += main.cpp CONFIG += link_pkgconfig PKGCONFIG += bluez
  • Unable to edit custom treeview with custom proxy and model: `editing failed`

    Solved
    2
    0 Votes
    2 Posts
    341 Views
    Please_Help_me_DP
    I'm idiot I missed Qt::ItemIsEditable flag... Don't know how it is possible to look at many times flags, even write them on the forum and still miss it... I hope I'm not alone :)
  • Parentheses expected, but code has sets of parentheses

    Solved
    12
    0 Votes
    12 Posts
    3k Views
    JKSHJ
    @micha_eleric said in Parentheses expected, but code has sets of parentheses: thank you for the explanation. You're most welcome. and yes, i am reading the link you posted. got questions, trying to figure it out. Feel free to post your questions here.
  • Qt5 with conan/cmake.

    Unsolved
    1
    0 Votes
    1 Posts
    960 Views
    No one has replied
  • Makefile error in QT "Makefile Error 3"

    Solved
    13
    0 Votes
    13 Posts
    6k Views
    CP71C
    @IsaacPrkr In first image you have missed + in INCLUDEPATH: INCLUDEPATH += \ You must remove the .PRO file from its self
  • C1083: Cannot open compiler generated file.

    Unsolved
    4
    0 Votes
    4 Posts
    2k Views
    SGaistS
    Hi, Why are there two different CMakeLists.txt files to build your project ?
  • QStyledItemDelegate inside a QTableView?

    Unsolved
    20
    0 Votes
    20 Posts
    3k Views
    mzimmersM
    @Christian-Ehrlicher I'm sorry, but I'm just not understanding something here. If I get a signal from the model, and respond to that signal by repainting/updating/whatever my QTableView, is that not sufficient to trigger my delegate's paint() event (which will update the COLUMN_PAINT_TIME column)? Thanks.... EDIT: well, what @Christian-Ehrlicher said was 100% right, but...I still don't understand the mechanism. I added a line in my worker thread to update the COLUMN_PAINT_TIME in the model, and now it seems to be working. (The date of model update in this case seems to be irrelevant, as the display is changed by the delegate.) What I don't understand is, if the COLUMN_PAINT_TIME in the view is under control of a delegate, why does the model have to be updated? If my widget slot is calling repaint/update/whatever unconditionally, why isn't that sufficient irrespective of the arguments in the signal/slot mechanism?
  • QChart::QLineSeries cpu performance

    Unsolved
    3
    0 Votes
    3 Posts
    251 Views
    sitesvS
    I just made a test without calculations... Just draw rand() or const values...
  • Fixed length auto update real time chart ploting In QML.

    Unsolved qml qml c++ charts real time plot
    1
    0 Votes
    1 Posts
    445 Views
    No one has replied
  • Build Qt 6.2.4 from source

    Unsolved
    2
    0 Votes
    2 Posts
    334 Views
    jsulmJ
    @thinhorigami Start here: https://wiki.qt.io/Building_Qt_6_from_Git
  • Plugin cannot be found by CMake

    Unsolved
    1
    0 Votes
    1 Posts
    184 Views
    No one has replied
  • PDF Table of contents

    Unsolved
    1
    0 Votes
    1 Posts
    165 Views
    No one has replied
  • Convert milliseconds to hours minutes seconds

    Solved
    7
    0 Votes
    7 Posts
    7k Views
    J.HilkJ
    @IknowQT said in Convert milliseconds to hours minutes seconds: 99 hours 356400000 99 Min 5940000 99 sec 99000 Add them all up and you get 362439000. I expected 99:99:99 to come out. thats not how time works. the highest factor, hours in your case, will always have to overflow numbers, where as minutes and seconds will be restrained between 0 and 59
  • How to use Virtual Keyboard in Modal Dialogs

    Unsolved
    1
    0 Votes
    1 Posts
    190 Views
    No one has replied
  • Keep getting " expected initializer before ':' when declaring dll

    Solved
    4
    0 Votes
    4 Posts
    2k Views
    L
    I found the problem... It was because i had 2 .hpp named the same way, one was with some other macros i used to code, and the second one was with the export macro alone.. They had both the same paths, so in the dll project it was let's say src/macros/defines.hpp, and in the app project where i import the dll it was the same, but i don't understand why when i was clicking on it, it was reffering me to the valid file which i wanted to use. Also, it worked for half a year, so i didn't bother to change it, probably it worked because the files didn't come in conflict, but since i changed a lot of paths in the dll project, it stopped working, and that's why i got the weird errors, the hpp was set to pragma once and the wrong file was applied, so the compiled treated it as some invalid syntax letters, still the macro in the editor was looking like it was applied, that's what fooled me.