Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.5k Topics 457.3k Posts
  • Custom widget plugin not shown on plugins list (Windows)

    Solved
    3
    0 Votes
    3 Posts
    569 Views
    DragoonD
    @Dragoon yes... it was... using a precompiled QtCreator binary found here the plugin works. Nope it was not... the problem was the path of plugins directory. As QtCreator config file states the folder in which it search for plugins is the plugins\bin\designer subfolder of the QtCreator tool directory i.e. (in standard Windows installs): C:\Qt\Tools\QtCreator\bin\plugins\designer And not (as make install script like to think): C:\Qt\<release>\<toolchain>\plugins\designer BTW on Windows the plugin must be compiled as Release otherwise QtCreator will not load it but you will have an explanation on the: Tools->Form Editor->About Qt Designer Plugins dialog.
  • C2102: '&' requires I-Value

    Unsolved
    3
    0 Votes
    3 Posts
    2k Views
    JonBJ
    @jorTry85 said in C2102: '&' requires I-Value: When i now try to comile it in QT Qt is not a compiler. You seem to be using MSVC compiler. That is where you you should be looking. I suggest you Google for C2102 and read e.g. the stackoverflow posts. It looks like you either change the compiler options ("disabling /permissive-") or better actually "fix". I believe it is telling you that those functions return a "temporary" object, so you shouldn't take its address, you should rather assign to a local variable and use that, or pass a const reference?
  • Can a widget be notified if it's parent changed?

    Solved parent & child signal & slot qdockwidget
    2
    0 Votes
    2 Posts
    671 Views
    bibasmallB
    I was looking for bool MyBaseClass::event(QEvent* e) { if (e->type() == QEvent::DynamicPropertyChange && qobject_cast<QDockWidget*>(parent())) //... }
  • QSystemTrayIcon tool tip not showing on mouse hover

    Unsolved
    10
    0 Votes
    10 Posts
    2k Views
    A
    @SGaist, I faced the same problem on Ubuntu 20.04. I have Qt5 and Qt6 installed, in both versions toolTips are not displayed. However, in Windows 10 everything works without problems. Windows 10: [image: 1e3bfadc-2a1a-475d-be1a-dc214a2a252a.png] Ubuntu 20.04 [image: d589b262-f452-4fd5-9e36-6a55b7d550e4.png]
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    11 Views
    No one has replied
  • invalid style sheet error for QButton

    Solved
    7
    0 Votes
    7 Posts
    1k Views
    jsulmJ
    @agmar C++ basics. What you wrote is not valid C++. A style-sheet is a string... And you also need to use https://doc.qt.io/qt-6/qwidget.html#styleSheet-prop if you want to set style-sheet in code.
  • Proper way for adding 2nd language

    Unsolved
    14
    0 Votes
    14 Posts
    914 Views
    Christian EhrlicherC
    @masa4 said in Proper way for adding 2nd language: But how will i change dynamically created widget's texts like this messagebox? Since you can't show a MessageBox and change the language simulatneously this shouldn't be a problem since the next time you call the message box you text is properly translated due to the tr() call. If you changed a text in your ui after setupUi() you have to do the same manually after the language change event. See the documentation.
  • QListWidget IconMode ,set selected style

    Unsolved
    2
    0 Votes
    2 Posts
    296 Views
    EmrecpE
    @wuj10n When adding QListWidgetItem to QListWidget, update QListWidgetItem flag like this listeWidgetItem.setFlags(listWidgetItem.flags() & (~Qt.ItemIsSelectable))
  • QDESIGNER_WIDGET_EXPORT macro usage

    Unsolved
    8
    0 Votes
    8 Posts
    508 Views
    DragoonD
    @Christian-Ehrlicher forget it I was editing the reply...
  • QWidget across the desktop space in macos?

    Unsolved
    3
    0 Votes
    3 Posts
    317 Views
    Z
    @stryga42 Thank you for your reply, what I want to do is on the Mac system, when I switch the desktop space, let the window switch with it and display it on the top layer forever. What I did try is as follows: // in .mm file, My own widget is subclass of QWidget NSPanel *window = [[NSPanel alloc] initWithContentRect:NSMakeRect(0, 0, size.width(), size.height()) styleMask:NSWindowStyleMaskFullSizeContentView | NSWindowStyleMaskBorderless | NSWindowStyleMaskNonactivatingPanel backing:NSBackingStoreBuffered defer:YES]; [window setHasShadow:false]; [window setHidesOnDeactivate:false]; [window setBackgroundColor:NSColor.clearColor]; [window setTitlebarAppearsTransparent:true]; [window setTitleVisibility:NSWindowTitleHidden]; [window setFloatingPanel:true]; [window setLevel:NSScreenSaverWindowLevel - zPosition]; [window setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces | NSWindowCollectionBehaviorFullScreenAuxiliary]; NSView *nativeWidgetView = (NSView*)(this->winId()); window.contentView = nativeWidgetView; This approach achieved my purpose, but it also caused a series of event distribution problems, such as not receiving QEvent::Enter...I don't know what to do and if there is any other way to do it?
  • Qt creator 9.0.2 inline editor error messages while compilation is fine

    Unsolved
    1
    0 Votes
    1 Posts
    141 Views
    No one has replied
  • QDialog close action on pressing Window 'X'

    Unsolved
    5
    0 Votes
    5 Posts
    311 Views
    D
    @JonB Got it, let me try that. Thank you!
  • QValidator: no spaces

    Solved
    8
    0 Votes
    8 Posts
    792 Views
    JonBJ
    @Dummie1138 Good on the backslashes, but no you are going too far. The attempt you had is actually close. It would need to be "^\\S*$" But if that doesn't work the link I referenced says QRegExpValidator already assumes ^...$ around your expression, i.e. complete match. So your ^/$ may be being taken literally. Try just "\\S*" ?
  • Scroll a pdf document in QPdfView

    Unsolved
    3
    0 Votes
    3 Posts
    337 Views
    F
    @jsulm said in Scroll a pdf document in QPdfView: @Faust-Faust Since it inherits https://doc.qt.io/qt-6/qabstractscrollarea.html it is possible I knew, but he didn't give me the method. QScrollBar *scrol = view->verticalScrollBar(); scrol->setSliderPosition(scrol->sliderPosition() + 100); Thank you.
  • Using Qt Virtual Keyboard to use predictive text input

    Unsolved
    1
    0 Votes
    1 Posts
    128 Views
    No one has replied
  • Drag n drop problem with Linux

    Unsolved
    3
    1 Votes
    3 Posts
    371 Views
    M
    @stryga42 Ubuntu 22.04.2 LTS with the standard wayland WM. I am dragging within my app (I drag a treeItem from its location to another in the same treeview). The code itself is very basic and it works as expected on windows void ProjectWidget::dragMoveEvent(QDragMoveEvent * event) { QTreeWidgetItem* currentItem = itemAt(event->position().toPoint()); if (currentItem == NULL) { event->ignore(); return; } if (latestDraggedItem == NULL) { event->ignore(); return; } QVariant v = latestDraggedItem->data(0,Qt::UserRole); if (v.value<ModelTemplate *>()) { if (currentItem == cardNode) { event->setDropAction(Qt::MoveAction); event->accept(); return; } } event->ignore(); }
  • Connecting Local MSSQL DB With QtSQL

    Unsolved
    4
    0 Votes
    4 Posts
    1k Views
    piervalliP
    @UmeyrMSekban Usually I use only a standard connection string, try with this //Driver={SQL Server Native Client 11.0};Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword; m_database = QSqlDatabase::addDatabase("QODBC", connectionName); QString dns = QString("Driver={SQL Server Native Client 11.0};Server=%1;Database=%4;Uid=%2;Pwd=%3;") .arg(m_host,m_userName,m_password, m_nameDB); qDebug() << "ODBC connection string" << dns << "driver"; m_database.setDatabaseName(dns); stato = m_database.open(); if(!stato){ qCritical() << m_database.lastError().text() << QSqlDatabase::drivers(); }
  • Project ERROR: Unknown module(s) in QT: webengine

    Solved
    9
    0 Votes
    9 Posts
    5k Views
    jsulmJ
    @jorTry85 As @SGaist wrote: you need to use Microsoft compiler, not MinGW.
  • qChecksum()

    Solved
    4
    0 Votes
    4 Posts
    881 Views
    W
    @Chris-Kawa Thanks for the pointer to the code. I'm new to Qt and still finding my way around.
  • Can I create a so file for CMAKE Project, using QT?

    Solved
    9
    0 Votes
    9 Posts
    604 Views
    C
    @manykim said in Can I create a so file for CMAKE Project, using QT?: I do not reckon where i did wrong... Did the linker even find your my_hello library? Post the link related commands and output executed by the Makefile that CMake generated for you. make VERBOSE=1