Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.3k Topics 455.6k Posts
  • QVector registered meta type in Qt 5.0

    Unsolved 3 Jul 2018, 15:30
    0 Votes
    6 Posts
    980 Views
    @VRonin said in QVector registered meta type in Qt 5.0: Looks like QVector<int> is pre-registered in Qt 5.1.1 but not in 5.0.2. I'm not sure what exact version introduced the change though You can ask Thiago, he'd probably remember. In any case I thought the core classes were registered from the get go, so this is news to me as well ...
  • 0 Votes
    1 Posts
    716 Views
    No one has replied
  • Mac on Qt 5.11 not deploying with Aqua look-and-feel?

    Unsolved 2 Jul 2018, 20:51
    0 Votes
    5 Posts
    833 Views
    @KillerSmath - we don't use macdeployqt - that may be part of the problem. Based on your comments, I built a bunch of examples with qmake, and they were just fine. So there's definitely a deploy problem.. I'll sort through it and post back here. Thanks for the suggestions.
  • QStyledItemDelegate with QLineEdit

    Unsolved 3 Jul 2018, 22:02
    0 Votes
    10 Posts
    3k Views
    @Elnur_Ismailzada So you want each cell to have 3 values? Well u can do that with delegate but most of the work will be handling the editor widget. it must then contain 3 Edits so user can select which one to edit and you must handle writing back the data to the model in correct index.
  • 0 Votes
    9 Posts
    1k Views
    hi @mad-hatter, thanks for your feedback! would you mind sharing your experience in the bugreport, so others can profit too? that would be awesome. regards
  • 0 Votes
    6 Posts
    846 Views
    @Tomax63 Probably you need to post some of your code. When you are using a button and clicking on it is retrieving the information from a usb, you might already use a (signal-)slot functionality. When you have done it in a Qt way you are probably only required to substitute the button trigger with a QTimer pulling the information on a regular time interval. However,that is a sort of a wild guess based on my experience and the way I would do. Best is posting the declaration of your class and at the routine doing the pulling of information and display. Did you use one of Qt templates to start off?
  • 0 Votes
    12 Posts
    3k Views
    @JonB Got it, Thanks!
  • 0 Votes
    4 Posts
    3k Views
    @robro You misunderstood what @VRonin wrote: you should NOT have such loops. Just use signals/slots in your app - there are no differences to UI apps.
  • QT3D or QT 3D Studio using boolean operations (CSG)

    Unsolved 4 Jul 2018, 10:50
    1 Votes
    1 Posts
    369 Views
    No one has replied
  • 0 Votes
    5 Posts
    704 Views
    @J.Hilk You're right, I will try timerEvent and startTimer instead. Thanks all! Have a nice day.
  • Qt Creator won't detect last changes

    Solved 2 Jul 2018, 21:32
    0 Votes
    10 Posts
    3k Views
    @jsulm Thanks for clarifying. So now everything is clear. Like @Gerhard said: "check the System times!". I was telling make that the source file is not newer, by editing it in 05/07/2018 (because I forgot to reset the date after changing it earlier), and then I remember that the date has to be reset to 04/07/2018, and then saving and building. Thanks, all!
  • Move rows in a QTableWidget

    Unsolved 4 Jul 2018, 08:43
    0 Votes
    2 Posts
    2k Views
    Unfortunately Qt generic models do not implement moveRows. You have 2 choices: save the data, remove the row, insert the row and re-set the data store temporary indexes in a user role and use QSortFilterProxyModel to sort it (requires switching to model+view and the change is not actually done in the original model)
  • How to rotate an image 90 clockwise?

    Solved 4 Jul 2018, 06:03
    0 Votes
    4 Posts
    3k Views
    Thanks for the help!!!
  • Save HTML from minibrowser example

    Unsolved 4 Jul 2018, 01:55
    0 Votes
    2 Posts
    325 Views
    @bandito i guess you have to use the runJavaScript method: WebView { id: webView anchors.fill: parent url: initialUrl onLoadingChanged: { if (loadRequest.status === WebView.LoadSucceededStatus) webView.runJavaScript("document.documentElement.innerHTML", function(result) { console.log(result); }); } } (untested)
  • QRenderCapture help

    Unsolved 3 Jul 2018, 08:57
    0 Votes
    3 Posts
    733 Views
    A screenshot could work, but it should only be of the 3D image part of my GUI. Also I guess if I use a screen shot, I can't make the black background transparent? Furthermore I would like to get the image, without showing it in the GUI. I mean render the 3D part, but not showing it to the user. Don't know if that is even possible
  • 0 Votes
    4 Posts
    557 Views
    Would it be possible for you to provide a minimal compilable example to reproduce the behaviour ?
  • Metal-accelerated QPainter on macOS with MoltenGL?

    Unsolved 4 Jul 2018, 02:25
    0 Votes
    2 Posts
    890 Views
    Hi, That's something you should rather bring to the interest mailing list. You'll find the Qt's developers/maintainers. This forum is more user oriented. Note that there's experimental support for MoltenVK on macOS planned for 5.12. You should be able to play with it using the dev branch.
  • How to add progress bar to specific treeview row,column?

    Unsolved 2 Jul 2018, 00:38
    0 Votes
    6 Posts
    3k Views
    @SRaD Look, think in a tree model setted up as below example: Item A (0,0,0) Item 1 (0,0,1) Item P1 (0,0,2) Item P2 (1,0,2) Item P3 (2,0,2) Item 2 (1,0,1) Item P1 (0,0,2) Item P2 (1,0,2) Item P3 (2,0,2) Item 3 (2,0,1) Item P1 (0,0,2) Item P2 (1,0,2) Item P3 (2,0,2) Note: Each child has a Z Level depending of their parent but the value of (X,Y) is reseted for each append. To set the Progressbar if the element is grandchild, you could to calculate the Z Level using the Parent of this element. Example: void ProgressDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const // override { int z = 0; for(QModelIndex parentIndex = index.parent(); parentIndex.isValid(); z++){ parentIndex = parentIndex.parent(); } if (index.column() == 0 && z==2) { QStyleOptionProgressBar progressBarOption; progressBarOption.state = QStyle::State_Enabled; progressBarOption.direction = QApplication::layoutDirection(); progressBarOption.rect = option.rect; progressBarOption.fontMetrics = QApplication::fontMetrics(); progressBarOption.minimum = 0; progressBarOption.maximum = 100; bool isNumber; int number = index.data(Qt::DisplayRole).toInt(&isNumber); if(isNumber){ progressBarOption.progress = number; } progressBarOption.textAlignment = Qt::AlignCenter; progressBarOption.textVisible = true; QApplication::style()->drawControl(QStyle::CE_ProgressBar, &progressBarOption, painter); } else QStyledItemDelegate::paint(painter, option, index); } QStandardItemModel *model = new QStandardItemModel(0,1,this); model->setHorizontalHeaderItem(0, new QStandardItem("Main Column")); ProgressDelegate *delegate = new ProgressDelegate(this); ui->treeView->setItemDelegate(delegate); ui->treeView->setModel(model); QStandardItem *ia; QStandardItem *i1,*i2,*i3; QStandardItem *p1,*p2,*p3; // (Row , Column , Z Level) ia = new QStandardItem("Item A"); // (0,0,0) i1 = new QStandardItem("Item 1"); // (0,0,1) p1 = new QStandardItem("15"); // (0,0,2) p2 = new QStandardItem("30"); // (1,0,2) p3 = new QStandardItem("12"); // (2,0,2) i1->appendRow(p1); i1->appendRow(p2); i1->appendRow(p3); ia->appendRow(i1); i2 = new QStandardItem("Item 2"); // (1,0,1) p1 = new QStandardItem("35"); // (0,0,2) p2 = new QStandardItem("77"); // (1,0,2) p3 = new QStandardItem("12"); // (2,0,2) i2->appendRow(p1); i2->appendRow(p2); i2->appendRow(p3); ia->appendRow(i2); i3 = new QStandardItem("Item 3"); // (2,0,1) p1 = new QStandardItem("7"); // (0,0,2) p2 = new QStandardItem("22"); // (1,0,2) p3 = new QStandardItem("85");// (2,0,2) i3->appendRow(p1); i3->appendRow(p2); i3->appendRow(p3); ia->appendRow(i3); model->appendRow(ia); // (0,0,0) Result [image: a58c7a44-9830-483c-80d6-72c49aaede3a.png] But this solution has a processing overhead to calculate the Z Level using the For Loop each time that paint event is called, so, seriously, the best solution is calculate the Z Level when the Data is appended on Model. Pseudo-code - when insert the data or changing the root: if has parent then Data[Z_Role] := parent_z_level + 1 else Data[Z_Role] := 0 You could easily get the Z Level on Delegate with this functionality // Z_Role = Qt::UserRole+1 int zLevel = index.data(Qt::UserRole+1).toInt()
  • 0 Votes
    41 Posts
    11k Views
    @Kinesis No need to feel bad - I'm helping here voluntary :-) I don't think you need to upload your code. If somebody has questions he/she can ask.
  • 0 Votes
    6 Posts
    1k Views
    Just got around to running an experiment with QWizard. If you create a non-linear wizard it will remember the order of pages you progressed through so that when you click back it will skip any pages that were skipped when moving forward through the wizard. Problem solved :)