Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.8k Posts
  • This topic is deleted!

    Unsolved
    6
    0 Votes
    6 Posts
    21 Views
  • Click & drag a QGraphicsItem inside QGraphicsScene?

    Unsolved
    3
    0 Votes
    3 Posts
    1k Views
    Pl45m4P
    @LiberRexPaimon said in Click & drag a QGraphicsItem inside QGraphicsScene?: void Scene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent){ if (mouseEvent->button() == Qt::LeftButton){ QGraphicsItem *item = itemAt(mouseEvent->scenePos(), QTransform()); Node *node = qgraphicsitem_cast<Node >(item); if(node){ removeItem(node); }else{ QPointF pt = mouseEvent->scenePos(); Node node = new Node(pt); addItem(node); } } QGraphicsScene::mouseReleaseEvent(mouseEvent); } In addition to what @JonB said: This implementation would remove nodes, even when you click and drag another node and only release the mouse button over an existing node. So I would add some check whether the node on which the mouse button was released, was pressed (mouse down) before. Therefore you could add a bool clicked to your Node class and check if it's true before removing the item from your scene to ensure that it is the correct item that was meant to be removed.
  • TwitchQt

    Unsolved
    9
    0 Votes
    9 Posts
    807 Views
    JKSHJ
    It sounds like the maintainer of TwitchQt did not fully test Qt 6 compatibility, and "some things might still be broken": https://github.com/jkbz64/TwitchQt/issues/3 So create an Issue on their GitHub repo and post your error message there (copy and paste the text, not a screenshot). This should help them fix the issue.
  • headerData of qabstracttablemodel unable to return QtCore.QVariant(list of strings)

    Solved
    11
    0 Votes
    11 Posts
    2k Views
    B
    @JonB Hey sorry for the trouble, the last line explains a lot of logic, i had never seen such an approach in python and nor in pyqt, so i got confused we usually use class.method(some datatypes) to execute/return values directly to the view/ui. This was new, Thank you for taking out time. Can you suggest any pages where i can refer such examples? But for now i'll close ticket.
  • QTypeInfo error on GCC

    Unsolved
    20
    0 Votes
    20 Posts
    2k Views
    JonBJ
    @Xumepoc I did ask you earlier where from your own code does the #include which leads to this error appear, but never got an answer. Never mind. I believe/suggest you might find your situation is reported on this forum in Q_DECLARE_TYPEINFO and namespaces - how does it work? from 2012? I suggest you read there. The final post indicates to me there is a change which will allow your code to compile under GCC as well as MSVC: Case 2: I did forget the semicolon after the Q_DECLARE_TYPEINFO. This case now works on both compilers. Thanks!
  • Looking for guidance on how to approach my "ladder viewer"

    Unsolved
    5
    0 Votes
    5 Posts
    548 Views
    D
    I appreciate the advice. I'll spend some time playing with Graphics View. Here is what I have currently, shows more of what is going on than the screenshots: https://www.youtube.com/watch?v=BWPunSVd2rk
  • QProcess start for mstsc (Remote Desktop) generates finished() signal immediately

    Solved
    17
    0 Votes
    17 Posts
    842 Views
    mrjjM
    @m4kas Good digging!
  • QCss::Parser -- how to reproduce behavior?

    Solved
    5
    0 Votes
    5 Posts
    668 Views
    E
    Thank you.
  • Appending an image to itemList of QFormLayout widgets

    Unsolved
    51
    0 Votes
    51 Posts
    7k Views
    mrjjM
    So when loading from db, you need to both set the UserRole and the pixmap field it sounds like even the error "object has no attribute 'img' " is very confusing if it is indeed a class member.
  • Can't delete information from table made with information pulled from sqlite3

    Unsolved
    3
    0 Votes
    3 Posts
    218 Views
    SGaistS
    Hi, Did you check that your database calls are successful ? Did you also consider using Qt's SQL module ?
  • QFileDialog::setFilter() does not show hidden files

    Unsolved
    15
    0 Votes
    15 Posts
    2k Views
    JonBJ
    @Mark81 said in QFileDialog::setFilter() does not show hidden files: It's still no clear to me how to show hidden files and directories.... In the way shown above. This code does not shown hidden files or directories. It does show them adding fileDialog.setOption(QFileDialog::DontUseNativeDialog); but I want to use the native file dialog. So that suggests the native dialog does not respond to your desired options from Qt. That's (partly) why I suggested trying the Qt dialog. As far as I know, the Qt dialog is capable of acting on every option/mode/preference you can pass to it from Qt, but is "not as pleasant" as the native dialog. But the native dialog behaves differently on each platform, and may not respond to all options as you would wish. Meanwhile, Googling for you for QDir::Hidden QFileDialog::DontUseNativeDialog I come across https://www.qtcentre.org/threads/67923-Get-QFileDialog-to-display-dot-folder-files. That is under some Linux and states fdlg = QtWidgets.QFileDialog() fdlg.setFilter(QDir.AllEntries | QDir.Hidden) if (fdlg.exec()): fileNames = fdlg.selectedFiles() fdlg.close() does work. That is all I know. Remember that Ubuntu nowadays by default is running GNOME rather than the traditional Unity desktop. The native file chooser dialog is supplied by the windowing system. Maybe the GNOME one ("Nautilus"?) does not supply the options you want, or they are not interfaced to from Qt.
  • 0 Votes
    3 Posts
    1k Views
    jeremy_kJ
    @Tom-asso said in Newbie question: How to spin a BusyIndicator while loading file data?: Just starting out with Qt threading api and have some questions. My C++/QML app reads data from a large file and displays it; the QML-defined GUI lets the user modify the display (e.g. with color maps, view angles, etc), and also provides a menu item to load data from another file. While loading data, I would like a QML BusyIndicator to spin, until the data is ready to display. While the BusyIndicator is spinning, the user should be prevented from trying to modify the display through the GUI. I realize the GUI thread must be running in order to spin the BusyIndicator, so presumably my GUI thread code should at least set the BusyIndicator.running property, and launch a worker thread which actually opens the new file and loads its data. What’s the best way to run a worker thread with Qt’s api? Do you plan to allow cancellation of loading? How do I prevent user interaction with other GUI controls while the worker thread is doing its job? Item has an enabled property that controls mouse and keyboard input for the item and its children. Eg: import QtQuick 2.12 import QtQuick.Window 2.12 Window { contentItem.enabled: false TextInput { anchors.centerIn: parent text: "This input is disabled by its parent" } } @AxelVienna said in Newbie question: How to spin a BusyIndicator while loading file data? QApplication::setOverrideCursor(Qt::WaitCursor); QGuiApplication, not QApplication. There's no need to involve widgets for a QML/Quick application.
  • Qt does not recognize objective-c header files?

    Solved
    8
    1 Votes
    8 Posts
    861 Views
    SGaistS
    @senmx said in Qt does not recognize objective-c header files?: @SGaist Tks. So objective-c code can only be typing in .mm files. .h or .cpp are considered standard C++ code? No, pure Objective-C is written in .m files. If you want to mix Objective-C and C++, use the .mm extension. .cpp, .cxx are extensions for C++. You can check the content of the QtMacExtras module for simple examples on how to write Objective-C++.
  • Send automatic emails with qt creator

    Unsolved
    2
    0 Votes
    2 Posts
    147 Views
    SGaistS
    Hi, I would recommend using curl for that. See an example here.
  • HTTP status code 101 when trying to make POST request

    Solved
    5
    0 Votes
    5 Posts
    696 Views
    nicmoraisN
    Nevermind, I'm implementing HTTPS and this should be safe enough. Thanks a lot!
  • Clicks disappearing

    Unsolved
    3
    0 Votes
    3 Posts
    272 Views
    D
    @Pl45m4 By dropped click, I mean I click on the button on the screen, but the OnClicked slot which is connected to the clicked signal of that button is not invoked.
  • what playing with Style Sheets

    Unsolved
    3
    0 Votes
    3 Posts
    292 Views
    JonBJ
    @ghemassageharuko No! If you are asking "can I access a value in a stylesheet?". For one thing, the stuff you put into a stylesheet does not map back to Qt's style(). All to the best of my knowledge! (Hello and welcome, btw!)
  • Indent qdebug output

    3
    0 Votes
    3 Posts
    3k Views
    S
    10 years later I'll just leave it here ... QDebug MyClass::qDebug1(int padding_width) { static QString s(" ");//placeholder QDebug ret = qDebug(); ret.noquote();//optional while(padding_width--) ret << s; return ret; } so @void MyClass:myMethod(){ qDebug1(1) << "[BEGIN] myMethod"; .... myOtherClassInstance->myMethod2();//qDebug1(2); qDebug(1) << "[END] myMethod"; }@ [BEGIN] myMethod [BEGIN] myMethod2 [END] myMethod2 [END] myMethod
  • QtWidgets/QAction: No such file or directory

    Unsolved
    2
    0 Votes
    2 Posts
    467 Views
    JoeCFDJ
    this file is normally generated automatically. No need to change anything unless you create it manually. Do you add widgets to QT in your pro? something like this? QT += core gui widgets
  • QTableView selects items not having flag Qt::ItemIsSelectable

    Unsolved
    4
    0 Votes
    4 Posts
    934 Views
    N
    Sorry, it turns out that our model was wrapped in a QSortFilterProxyModel which overrided the flags() method. I didn't know this. This reimplementation ignored the actual item flag in the wrapped model. Now I can see that QTableView is working as it should :) QTableView still changes focus (changes current index) when any cell is clicked. Not sure if this can be prevented, I'll take a look.