@AnneRanch said in Wrong project executing - wrong path:
I can see wrong path and wrong "main" is being executed.
Since you are using Qt Creator (from what I can tell), you can switch between active projects.
(there must be something like "Set as active project", if you right click your project folder on the right of Qt Creator).
Does your Qt installation work at all?
How you installed Qt / Qt Creator?
The easy way to test whether the example projects run or not would be to go to the welcome screen of Qt Creator and select an example from "Examples" tab.
Even if you want to clone your code from git, you could give it a try and see if you can run examples from there.
What Linux distribution are you using?
Qt Creator 3.5 seems a bit outdated to me
@AnneRanch said in How to troubleshoot / debug - beginner's question:
WHY it did not come with cloning ?
This line is actually included
Ah never mind. So it's working now?
@fem_dev said in connect: External "C" function:
Because each plugin is loaded by the main application using QPluginLoader.
So, I think that I can't use this line above inside the Plugin class. Am I right?
You are right, the example code that I wrote must be placed in your main application, not your plugin.
Note: That example expects a single plugin instance. If you want to load multiple plugins at the same time, then you'll need a vector of pointers, not just a single pointer.
A first thought that comes to mind is that I should try to make this connection entirely within the shared library (plugin) project, without resorting to the main application project.
I don't think that's a good design. A plugin should not be aware of the main application, so a plugin shouldn't be expected to know that fortranMsg() exists.
The main application should load the plugin and make all necessary "connections" to the plugin.
Or is there a better way to "connect" via the main application?
Let's step back a bit. Ignore the Fortran code for now.
How do you currently pass any data from your main application into your plugin objects?
qgraphicsitem_cast basically does if (item->type() == T::Type) return static_cast<T>(item) so potentially a lot faster than dynamic_cast, which needs to do runtime RTTI traversal.
If you do that check often it's definitely worth it.
@VRonin said in Custom class serialize with QDataStream:
I don't like your serialisation with reinterpret_cast
What is wrong with it? Is there any real risk associatied with using it in such situation? Or is it just a prejuidice because it is generally regarded to be unsafe?
Yeah I thought about that, but I assume the lock will still be held and the temp file will just fail to be deleted still. This way at least I know where the file is on each program start and can delete or overwrite it if needed.
Thanks for your help though!
Glad you found out and thanks for sharing the solution.
Out of curiosity, are you using applicationShouldTerminate to avoid the application to end while the system tray icon stays alive ? If so, it's not needed, Qt already provides quitOnLastWindowClosed for that kind of use cases.
@JohnSRV said in How to get multiple selected Items from a QListwidget:
connect(ui->TargetList, SIGNAL(itemSelectionChange()), this, SLOT(SelectedTargets()));
And, use QListWidget::selectedItems() to get all selected items.
Here is the code.
QList<SomeClass> ModeTableEntries ;
for (int row = 0; row < ModeTableEntries .length(); row++)
ModeValues value = ModeTableEntries [row];
QTableWidgetItem* currentItem = new QTableWidgetItem(value .ModeText);
if(TestModeEnabled == true)
ui->EntriesTableWidget->setItem( row, 0, currentItem);
The problem is that I cannot style the default implementation of the QTableWidgetItem(QCheckbox) that is part of the QTableWidgetItem.
@JonB Thanks. With your help and some others, I have finally narrowed down my query to
QRegularExpression whereListRegex(R"(\sWHERE\s+(.*?)(?:\s+(?:GROUP|ORDER|LIMIT)\b|\s*$))", QRegularExpression::CaseInsensitiveOption);
This works for both the conditions I have asked for
Thanks! For anyone who happens to look this up in the future, the code in my first post contains a few errors. The code posted below is working for me:
void Widget::keyPressEvent(QKeyEvent *event)
if (event->key() == Qt::Key_Alt)
void Widget::keyReleaseEvent(QKeyEvent *event)
if (event->key() == Qt::Key_Alt)
(Note: I had to switch to a meta-key because the pressing and holding the "D" key caused lots of "D"s to be entered into random editable widgets.)
@NageswaRao said in How to update label position which is added on mainwindhow.ui using QT programatically?:
you mean I need to add a label from the CPP code right?
No, you just should not add it to any layouts
Hi Jsulm, thank you. OpenGL is used in sample application. so because of different layers on-screen, able to capture one layer. but with the below code, we achieved what I needed. thank you.
QRect crop_rect(500, 500, 250, 250);
QImage desk = qApp->screens().at(0)->grabWindow(
ui->label_pic->setStyleSheet("border:5px solid grey");
@jsulm @JonB Thanks for comments.
I solved with creating another QGridLayout, when search text edit's textChanged, clearing all widgets in first QGridLayout; then I am looping in second QGridLayout (all widgets here), if it's compatible with variable then i am adding to first QGridLayout. Then i show first QGridLayout.
I was hoping QGridLayout do this automaticly.
Here is code if someone needs
# CLEAR WIDGETs
for i in range(1, self.vbox.count()):
if self.vbox.itemAt(i) != None and self.vbox.itemAt(i).widget()!=None:
# < CLEAR WIDGETs >
INDEX = 1
for i in range( self.QGRID_ALL_WIDGETS.count()):
if self.QGRID_ALL_WIDGETS.itemAt(i) != None and self.QGRID_ALL_WIDGETS.itemAt(i).widget() != None:
if (str(Ad).lower() in str(SearchText).lower()): # Ad is my special variable
self.vbox.addWidget(wid, math.ceil(INDEX / 2), (INDEX - 1) % 2, 1, 1)
INDEX += 1
@Merlino said in QTcpServer, I can't use the main event loop:
Do you have any idea how this problem can be solved?
You can have Qt event loop in the thread where you're using QTcpServer: https://doc.qt.io/qt-5/qeventloop.html
@isan said in Cannot run the Simple MQTT Client Example on Raspberry Pi:
set solib-search-path ./Debug/
Since your Qt libs are in /usr/local/qt5pi/lib it should be
set solib-search-path /usr/local/qt5pi/lib
I would say.
Thanks guys, yes it seems to be the executable that does not want to output its stdout in the tcl mode. I can see output if I call it in GUI mode (but obviously the GUI starts up instead). I am just going to have it write output to a file unfortunately.
@SGaist The tcl command line opens in the same command window. When calling the GUI mode, some output shows in the command window, and then the GUI appears in its own window.
@JonB I will give the command line piping a try as well for curiosity's sake, thank you.
Thanks for the help!
I don't like the syntax, that's the problem.
Well I don't like python syntax either but it really beats hands down the
syntax you will be looking at using native API to send external events to the game app.
So if provides the features you want to bot the app,
it might end up be less ugly code in python than using c++ and windows api :)
Thanks for your answer. All I'm asking is - would this be a sane thing to implement, or am I missing something obvious? If the rest of the event-system allowed such functionality, would it be able to e.g. replace the original installEventFilter method? Obviously, my version would need to have 1 additional parameter besides QEvent - that would be QObject representing the receiver of the event. I don't have any specific requirement, this is just an off-topic, I guess.
I have created "Users" table after creating "Inventory" table in items.db from Sqlite Studio. Using another database manager software I could see Both Tables in items.db but
if(query.exec(Select username........ from Users)) showed Users is unavailable.
I used sqlite3 from terminal and it showed Error: No such Tables: Users
So I deleted Users from Sqlite Studio and entered new Users table from terminal and it Worked.
(I will look more into Sqlite Studio as changes made into Inventory form the same app worked.)
Thank you and other contributors.
Thank you Foxoman,
I tried your method and it stopped at
cd ~/QtStatic/5.14.0/build; ~/QtStatic/5.14.0/Src/configure -v -static -release -ltcg -optimize-size -no-pch -prefix ~/Qt5static/5.14.0/ -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -qt-xcb -qt-harfbuzz -make libs -nomake tools -nomake examples -nomake tests -opensource -confirm-license -skip qtwebengine -dbus-linked -no-rpath -openssl-linked -opengl desktop -sysconfdir "/etc/xdg" -no-qml-debug -feature-freetype -fontconfig -feature-relocatable -strip
Note: Overriding option 'freetype' with 'yes' (was: 'qt')
Note: Also available for Linux: linux-clang linux-icc
Note: Using static linking will disable the use of dynamically
loaded plugins. Make sure to import all needed static plugins,
or compile needed modules into the library.
Note: No wayland-egl support detected. Cross-toolkit compatibility disabled.
WARNING: QDoc will not be compiled, probably because libclang could not be located. This means that you cannot build the Qt documentation.
Either ensure that llvm-config is in your PATH environment variable, or set LLVM_INSTALL_DIR to the location of your llvm installation.
On Linux systems, you may be able to install libclang by installing the libclang-dev or libclang-devel package, depending on your distribution.
On macOS, you can use Homebrew's llvm package.
On Windows, you must set LLVM_INSTALL_DIR to the installation path.
ERROR: Feature 'dbus-linked' was enabled, but the pre-condition 'features.dbus && libs.dbus' failed.
ERROR: Feature 'openssl-linked' was enabled, but the pre-condition '!features.securetransport && !features.schannel && libs.openssl' failed.
ERROR: Feature 'xcb' was enabled, but the pre-condition 'features.thread && features.xkbcommon && libs.xcb' failed.
ERROR: Feature 'fontconfig' was enabled, but the pre-condition '!config.msvc && features.system-freetype && libs.fontconfig' failed.