Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • General design help

    Unsolved
    4
    0 Votes
    4 Posts
    324 Views
    P
    @Padgaus Found the layouts, thanks for your help, i'll try some stuff out!
  • Not able to pass data from C++ to QML

    Solved
    7
    0 Votes
    7 Posts
    766 Views
    Pablo J. RoginaP
    @SteMMo said in Not able to pass data from C++ to QML: Hope I finally solved ... If so, please don't forget to mark your post as such! Thanks.
  • Using a custom data type and editor in QStandardItemModel

    Solved
    11
    0 Votes
    11 Posts
    3k Views
    L
    @mrjj Thanks, that works for my use case Setting the data: if (node->value_category != TC_ASSIGNABLE_NONE) { QStandardItem *editorItem = new QStandardItem; QVariant v; AssignableData data(node); v.setValue(data); editorItem->setData(v, Qt::UserRole); //editorItem->setText(node->name); rowItems.append(editorItem); } Setting editor data in the delegate: void AssignableEditorDelegate::setEditorData(QWidget* editor, const QModelIndex &index) const { AssignableData data = qvariant_cast<AssignableData>(index.model()->data(index, Qt::UserRole)); switch (data.m_valueCategory) { case TC_ASSIGNABLE_RANGE: switch (data.m_rangeInfo.range_data_type) { case TC_ASSIGNABLE_RANGE_INT: { IntRangeEditor *ed = static_cast<IntRangeEditor*>(editor); ed->setValue(data.value().toInt()); break; } default: break; } default: break; } } Setting model data: void AssignableEditorDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const { AssignableData data = qvariant_cast<AssignableData>(index.model()->data(index, Qt::UserRole)); QVariant v; QStandardItemModel *s_model = static_cast<QStandardItemModel*>(model); switch (data.m_valueCategory) { ... case TC_ASSIGNABLE_RANGE: switch (data.m_rangeInfo.range_data_type) { case TC_ASSIGNABLE_RANGE_INT: { IntRangeEditor *ed = static_cast<IntRangeEditor*>(editor); data.setValue(ed->value()); v.setValue(data); s_model->setData(index, v, Qt::UserRole); s_model->setData(index, ed->value(), Qt::DisplayRole); break; } default: break; } default: break; } } I also had to do setAutoFillBackground(true); in my editor widget to make the display text not overlap with the editor.
  • programmatically promote a widget

    Unsolved
    12
    0 Votes
    12 Posts
    1k Views
    mrjjM
    @hobbyProgrammer Hi The widget is the canvas. The image is resized to the widget. So you can set scribbleArea->setMinimumSize(500, 500); // "image size" to the size of any image you load to make it that size.
  • The program has unexpectedly finished (Windows)

    Solved
    4
    0 Votes
    4 Posts
    373 Views
    SGaistS
    Nothing like a hard reset... Anyway, glad you are back on track. Happy coding !
  • This topic is deleted!

    Unsolved
    2
    0 Votes
    2 Posts
    9 Views
  • Auto-indent selection

    Solved
    9
    0 Votes
    9 Posts
    1k Views
    ODБOïO
    hi just to add @jsulm said in Auto-indent selection: Go to "Tools/Text Editing Macros/Record Macro" (or press Alt+[) and record your macro. then "tools/options/environment // keyboard // record your shortcut" https://doc.qt.io/qtcreator/creator-macros.html edit :my bad. This was already stated by @Chris-Kawa
  • Cant able to view the Tools in design option

    Solved
    6
    0 Votes
    6 Posts
    401 Views
    jsulmJ
    @SURYA-P Please mark this thread as solved (bottom right corner "Topic Tools")
  • 0 Votes
    1 Posts
    209 Views
    No one has replied
  • Licence question for Qt/Python/MPL2

    Unsolved
    7
    0 Votes
    7 Posts
    511 Views
    V
    Thanks for bringing up the PyQt/PySide2 issue. I was completely unaware of that. I will switch to PySide2. So I now I have both Qt and PySide2 under LGPL. Then (https://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License) LGPL allows the work to be linked with (in the case of a library, "used by") a non-(L)GPLed program, regardless of whether it is free software or proprietary software.[2] The non-(L)GPLed program can then be distributed under any terms if it is not a derivative work. And my package is not a derivative work: "A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License." And with making the full source code of my package available users would be free to reverse engineer anything anyways. So everything would be ok?
  • Serial Port Communication with Arduino

    Unsolved
    6
    0 Votes
    6 Posts
    2k Views
    aha_1980A
    @Will_Craig your protocol should really have a start/end of line marker, as it makes parsing so much easier. It may be impossible to understand the data if you only have int or float strings with comma between. Regards
  • 0 Votes
    4 Posts
    2k Views
    S
    @jsulm thanks for your response. i would like to get the date and time from NTP server not form System(Date & Time) this is my primary task. I don't know how to get the data from NTP server. and in the above code i was tried but got the wrong timestamp(date and time) like 16th jan 2036.
  • Can I use show()/exec() in a Secondary thread

    Solved
    12
    0 Votes
    12 Posts
    2k Views
    T
    @JKSH Thank you for your answer. The QMetaObject::invokeMethod is helpful.
  • Valgrind Memory Analyzer is crashing Qt Creator

    Solved
    5
    0 Votes
    5 Posts
    536 Views
    GuerrianG
    I upgraded to Qt Creator 4.10.1 and recompiled my app. I get an actual reported error now as opposed to a crash. So I'm marking this as solved.
  • How do I prevent the QSlider from bouncing off the edge?

    Unsolved
    5
    0 Votes
    5 Posts
    383 Views
    deevromanD
    @SGaist Built under Qt 2.15.3. It got better, but the problem didn't disappear to the end. I hooked up a mouse to the MacBook, and the slider stopped bouncing. Looks like the trackpad or qslider is too sensitive, so qslider bounces back
  • How to find current line number in QTextEdit?

    Unsolved
    2
    0 Votes
    2 Posts
    5k Views
    SGaistS
    Hi, The solution proposed here might be what you are looking for.
  • Connection between classes.

    Solved
    10
    0 Votes
    10 Posts
    886 Views
    X
    @Pablo-J-Rogina Sure.:)
  • Fullscreen and transparent window on MacOS

    Solved
    5
    0 Votes
    5 Posts
    1k Views
    G
    I am actually not concerned with a cross platform solution, although it would be nice. It is a good idea taking a screenshot. It is a dirty solution, however, because of the flickering when I change to the window and the animation when I close the window. I guess for better results I would have to dig deeper into how to build GUI on MacOS in general. Thanks, anyway!
  • How to emit signal dynamically

    Solved
    5
    0 Votes
    5 Posts
    1k Views
    Pablo J. RoginaP
    @Luis-Ortiz said in How to emit signal dynamically: I will use the @mpergand instead Could your issue be called as solved? If so, please don't forget to mark your post as such.
  • Qt Udemy Courses - Qt Core

    Unsolved
    1
    2 Votes
    1 Posts
    129 Views
    No one has replied