Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.6k Posts
  • Code for each object.

    Unsolved
    2
    0 Votes
    2 Posts
    181 Views
    SGaistS
    Hi and welcome to devnet, When is that code called ?
  • This topic is deleted!

    Solved
    2
    0 Votes
    2 Posts
    30 Views
  • Index of an item in a treeview

    Unsolved
    2
    0 Votes
    2 Posts
    463 Views
    JonBJ
    @AndreiDS I don't follow the details of your particular case. But are you aware that any Qt model's data()/setData() can be used to store & retrieve any arbitrary value by using a role number you define from Qt::UserRole upward? So whatever you actual data in a model row/column you can always add a setData(model->index(row, col), real_data); setData(model->index(row, col), something_like_a_ unique_id, Qt::UserRole); So when you are putting data into the model you can add whatever you want as a "reference" with it, to be retrieved later via data(index, Qt::UserRole).
  • QCheckBox qt 4.8

    Unsolved
    1
    0 Votes
    1 Posts
    186 Views
    No one has replied
  • 1 Votes
    2 Posts
    536 Views
    W
    Encountering exactly the same problem with msvc9.0. Did not found a possibility to change the clangd.exe flags. Does anybody know if there is a possibility to configure the clangd.exe in the QtCreator?
  • Trouble with serializing and deserializing structs

    Solved
    8
    0 Votes
    8 Posts
    1k Views
    S
    I know that reinterpret_cast works quite well. IIRC the standard does not give you that guarantee, though. Shouldn't we, at least starting with C++20, be using bit_cast instead? I have not switched over to C++20, so I am a little shady on the details. Can anyone chime in if bit_cast would work here (and be possibly more correct)?
  • How to change the text background in QTableView

    Unsolved
    11
    0 Votes
    11 Posts
    2k Views
    U
    Hello, I'm designing a combobox that contains 2 column items, and can do filters and shorting based on what is typed in the combobox, the problem is that the combobox doesn't always appear when I write a search. void Dialog_Sell::getCmbStock(){ QStandardItemModel *model= new QStandardItemModel(arrStock.size(), 2, this); for(int i=0; i<arrStock.size(); i++){ QStandardItem *kol1 = new QStandardItem( QString("%0").arg(code[i]) ); QStandardItem *kol2 = new QStandardItem( QString("%0").arg(name[i]) ); model->setItem(i, 0, kol1); model->setItem(i, 1, kol2); } delegate = new Delegate(); QTableView* tableView = new QTableView( this ); QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel(this); proxyModel->setSourceModel(model); proxyModel->setFilterKeyColumn(-1); tableView->setModel( proxyModel); tableView->setItemDelegate(delegate); tableView->verticalHeader()->setVisible(false); tableView->horizontalHeader()->setVisible(false); tableView->setColumnWidth ( 0, 60 ); tableView->setColumnWidth ( 1, 260 ); tableView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); //tableView->setSelectionBehavior(QAbstractItemView::SelectRows); tableView->setStyleSheet("background-color: rgb(255, 255, 255);"); tableView->setAutoScroll(false); tableView->setShowGrid(false); tableView->setAlternatingRowColors(true); tableView->setSortingEnabled(false); tableView->setVerticalScrollMode(QTableView::ScrollPerPixel); connect(ui->cmbStock, &QComboBox::editTextChanged, [=]{ QString query = ui->cmbStock->currentText(); delegate->setQuery(query); //proxyModel->setFilterRegularExpression(query); proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); proxyModel->invalidate(); //return ; }); ui->cmbStock->setModel(proxyModel); ui->cmbStock->setView( tableView ); ui->cmbStock->setStyleSheet("QComboBox QAbstractItemView {min-width: 250px;}" "QComboBox { background-color: white; }"); } [image: 3f59bc16-b6f9-45ca-a044-a0abaf1d8d42.png]
  • Sending keystrokes to QProcess

    Unsolved
    6
    0 Votes
    6 Posts
    1k Views
    JonBJ
    @ChrisW67 said in Sending keystrokes to QProcess: There is the possibility that the command line tool is not reading from its standard input stream (the channel that it would receive what is sent by write()) but receiving key codes another way. In that case you are likely to need an operating system specific method to inject keystrokes (This would likely be fragile). @MisterMilk24 This is possible. Or it is possible that the process only reacts to Enter as you describe when that comes from a terminal, not any other stdin. One thing you could try: Put your "response(s)" into a file. Try from a Command Prompt running theprocess < inputfile to see whether that "works" the same as if you type those response characters into its input from a terminal. It is true that this test does not allow a "delay", e.g. waiting for the process to print "Press enter to continue or q to quit" before entering the first "response" character, we don't know for sure what the consequence will be. But it's an interesting test. Certainly if you can make it work this way you should be able to via QProcess. If it does not behave as it would when stdin is from a terminal that is an indication that your hope to automate may not be possible.....
  • Qt C++ QComboBox popup two column

    Unsolved
    1
    0 Votes
    1 Posts
    283 Views
    No one has replied
  • OPCUA x509 certificate creation with errors

    Unsolved
    1
    0 Votes
    1 Posts
    195 Views
    No one has replied
  • Good book for QT version 6

    Unsolved
    1
    0 Votes
    1 Posts
    108 Views
    No one has replied
  • How to set hotkey's that work in Linux?

    Solved
    8
    0 Votes
    8 Posts
    560 Views
    JonBJ
    @J-Hilk Not sure what you mean. But if I really need to spell it out it should be How to set hotkeys that work in Linux? hotkeys is the plural of hotkey. hotkey's is a possessive, referring to something which "belongs to" one hoykey, like the hotkey's action. And hotkeys' is also a possessive, referring to something belonging to multiple hotkeys, like all the hotkeys' actions. If you don't like the that, How to set hotkeys which work in Linux? would be equally acceptable, possibly marginally preferable. Here endeth the lesson. I do not wish to carp over spelling/grammar in English, but I would expect my colleague @SPlatten to be aware of this. The world is going to the dogs! No offence to anyone intended :) P.S. Go read Eats, Shoots & Leaves if you want to understand why punctuation rules can be so important in English. [No pandas were harmed in the writing of that book!]
  • Alt + Key, how to create QKeySequence?

    Solved
    9
    0 Votes
    9 Posts
    719 Views
    SPlattenS
    @ollarch , yes, that works, thank you.
  • Building static Qt using Mingw32 including openssl fails

    Unsolved
    8
    0 Votes
    8 Posts
    636 Views
    jsulmJ
    @xenovas Make sure you're building in a clean build folder (without build artefacts from previous tries). So, create a new build folder, change to that folder and do all the steps again (like calling configure, make, make install).
  • Use variables from file A in file B in C++

    Unsolved
    4
    0 Votes
    4 Posts
    467 Views
    JonBJ
    @Pueablo said in Use variables from file A in file B in C++: @JonB Don't forget to declare the variables as public. ? @JonB said in Use variables from file A in file B in C++: Whatever is declared public in A.h can be accessed from B.
  • When returning a qvector, the contents of the qvector are lost.

    Solved
    7
    0 Votes
    7 Posts
    562 Views
    KroMignonK
    @IknowQT said in When returning a qvector, the contents of the qvector are lost.: QVector<QVector<double>>* get_newX() { return m_newX; }; QVector<QVector<double>>* get_newY() { return m_newY; }; Pa->get_newX()[i][0] = X[i][0]; Pa->get_newY()[i][0] = Y[i][0]; If I read right your code, Pa->get_newX() and Pa->get_newY() returns a pointer! Should be: (*Pa->get_newX())[i][0] = X[i][0]; (*Pa->get_newY())[i][0] = Y[i][0]; But looks ugly to me, I would work with references or add some more helper functions, like setX() / setY()
  • This topic is deleted!

    Unsolved
    2
    0 Votes
    2 Posts
    82 Views
  • MAX QT VERSION

    Unsolved
    6
    0 Votes
    6 Posts
    650 Views
    SGaistS
    @Pl45m4 said in MAX QT VERSION: @SGaist said in MAX QT VERSION: For qmake, that is wrong, it's still supported in Qt 6 for user project although not encouraged. Oh ok... Learned something :) I thought they moved completely to CMake in Qt6. The build system for Qt itself has however the goal was not to break everybody's projects hence qmake is still available as a tool so that current project can easily migrate to Qt 6. They also have a script to help port from qmake project to cmake.
  • Please - explain the purpose of highlighted code

    Solved
    3
    0 Votes
    3 Posts
    241 Views
    A
    @JKSH I was under wrong impression that the function parameters names ( TYPE) passed to " run" should have same names as used in the function declaration. SOLVED
  • Customizing MVC's view: is it possible to use CSS instead of delegate?

    Solved
    10
    0 Votes
    10 Posts
    754 Views
    SGaistS
    Each item does not mean you cannot use data from different parts of the model. The model that feeds your list view will likely be a table, so in your delegate you will retrieve the data from the siblings of the current index to do your painting.