Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.5k Topics 457.3k Posts
  • Error: undefined reference to `cvReleaseImage' (opencv + Qt)

    Moved
    36
    0 Votes
    36 Posts
    22k Views
    D
    @RodMckay said in Error: undefined reference to `cvReleaseImage' (opencv + Qt): I try to write a simple image viewer program by using opencv int Qt5.1 the problem is that Qt5.1 shows me the error in runtime , where am I wrong ? .pro @ #------------------------------------------------- Project created by QtCreator 2013-09-11T03:55:37 #------------------------------------------------- QT += core QT -= gui TARGET = camera_onConsole CONFIG += console CONFIG -= app_bundle TEMPLATE = app INCLUDEPATH += D:\opencv\build\include LIBS += -lopencv_highgui246 -lopencv_imgproc246 -lopencv_objdetect246 SOURCES += main.cpp @ .cpp @ #include <QCoreApplication> #include "opencv/cv.h" #include "opencv/highgui.h" #include <opencv/cxcore.h> int main(int argc, char argv[]) { QCoreApplication a(argc, argv); IplImage img = cvLoadImage("D:/image.jpg"); cvNamedWindow( "Example1", CV_WINDOW_AUTOSIZE ); cvShowImage("Example1", img); cvWaitKey(0); cvReleaseImage(&img); cvDestroyWindow( "Example1" ); return a.exec(); } @ is there anyone who knows solution of this ? thanks for replies The error in the runtime could be due to various reasons, and it would be helpful if you could provide more information about the specific error message or behavior that you are encountering. However, based on the code that you have provided, there are a few issues that might be causing the problem: The Qt project file (.pro) is missing the inclusion of the "widgets" module, which is required for creating GUI applications. You can add it by modifying the "QT" line in your .pro file to: QT += core widgets The OpenCV library that you are linking to is version 2.4.6, which might not be compatible with the version of Qt that you are using (Qt 5.1). You could try linking to a more recent version of OpenCV (e.g., 4.x), or using an older version of Qt that is compatible with OpenCV 2.4.6. The use of the "IplImage" data type is deprecated in newer versions of OpenCV, and you might encounter compatibility issues when using it with Qt. You could try using the newer "cv::Mat" data type instead, which is recommended for working with images in OpenCV. Here is a modified version of your code that addresses these issues: .pro @ #------------------------------------------------- Project created by QtCreator 2013-09-11T03:55:37 #------------------------------------------------- QT += core widgets TARGET = camera_onConsole CONFIG += console CONFIG -= app_bundle TEMPLATE = app INCLUDEPATH += D:\opencv\build\include LIBS += -lopencv_highgui -lopencv_imgproc -lopencv_objdetect SOURCES += main.cpp @ .cpp @ #include <QCoreApplication> #include <opencv2/core.hpp> #include <opencv2/highgui.hpp> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); cv::Mat img = cv::imread("D:/image.jpg"); cv::namedWindow("Example1", cv::WINDOW_AUTOSIZE); cv::imshow("Example1", img); cv::waitKey(0); cv::destroyWindow("Example1"); return a.exec(); } @ Note that this code uses the newer "cv::Mat" data type instead of "IplImage", and also uses the updated function names for creating and destroying windows in OpenCV.
  • Qt5SQL MS SQL server querying is slow

    Unsolved
    4
    0 Votes
    4 Posts
    618 Views
    R
    Well I was able to get a significant speed increase in a production build by doing a bunch of query optimization. I no longer query a nvchar(400), 26million times. Instead, I let the server filter the names, into a new table and then I query the new table for all the names and create a map in my program. Luckily the database has a unique ID for every name. This is how I expected I would have to do it if I was processing billions of rows. I guess I will need to stick with Linux if I do that. My processData() code is slower than it is on linux for some reason. SQLServer::loop() processed 26800000 messages in 227282 ms
  • Where is QOpenGLWidget?

    Solved
    7
    0 Votes
    7 Posts
    5k Views
    F
    @appas Thank you, you saved me)
  • Cross platform taskbar progress indicator

    Unsolved
    2
    0 Votes
    2 Posts
    224 Views
    SGaistS
    Hi, Since it's a user forum, you are not very likely going to get an answer about that. In between, nothing forbids you to try and build the module with Qt 6 and integrate it into your application.
  • Problem with QPlainTextEdit

    Solved
    9
    0 Votes
    9 Posts
    587 Views
    JonBJ
    @GGG03 said in Problem with QPlainTextEdit: I found the problem. It was the font. I was using Terminal 9, and with Segou UI it is not laggy. LOL! Hopeless.
  • Error while loading shared libraries: libQt5Charts.so.5

    Solved
    5
    0 Votes
    5 Posts
    3k Views
    V
    @MarcoChiesi79 Even though this ones quite old: Would you mind explaining how exactly to include the library and perform the new bitbake? This would help me and maybe others having your exact issue.
  • Is there an easy way to escape all non-ASCII characters of a QString?

    Solved
    15
    0 Votes
    15 Posts
    4k Views
    l3u_L
    @l3u_ However, it would be encoded as =01, not =1 ;-)
  • Is it possible with QScrollArea behave like a wheel?

    Solved
    6
    0 Votes
    6 Posts
    703 Views
    C
    @TheoSys What if this feature gets suggested? Although the only way that I found to do that is by using the bug report system. But then I suspect it would be shut down as "user can implement this themselves".
  • QByteArray Datetime convert

    Solved
    6
    0 Votes
    6 Posts
    717 Views
    JonBJ
    @Abderrahmene_Rayene Absolutely no harm saying so your way :) Preference only. Just make 100% sure the fromString()/toString() work the same way as each other with regard to local time vs universal time.
  • Convert QByteArray to int

    Solved
    6
    0 Votes
    6 Posts
    937 Views
    Christian EhrlicherC
    @Damian7546 said in Convert QByteArray to int: quint16 val = buf2.toHex().toInt(nullptr,10); No, since toInt() converts readable characters written as integers, not binary stuff - please read the documentation.
  • How to install newer version Qt6 in Mint ?

    Unsolved
    3
    0 Votes
    3 Posts
    5k Views
    JonBJ
    @ChrisW67 , @AndrzejB But don't come back to us if you find the download isn't working right now... ;-)
  • Qt3DExtras Weird behaviour with materials

    Unsolved
    1
    0 Votes
    1 Posts
    125 Views
    No one has replied
  • QQuaternion convert euler angle to quaternion not work

    Solved
    3
    0 Votes
    3 Posts
    321 Views
    W
    @SGaist thks, i mixed qquaternion with eigen library.
  • Qt Installer Mac OS X Broken

    Unsolved
    1
    0 Votes
    1 Posts
    146 Views
    No one has replied
  • How to test QTableView cell editing in a unit test?

    Unsolved
    2
    0 Votes
    2 Posts
    334 Views
    SGaistS
    Hi and welcome to devnet, You should check that you actually got an editor. Did you consider using the edit method ? It would be simpler than trying to click on the table view.
  • Populate QTreeView from SQL.

    Solved
    6
    0 Votes
    6 Posts
    2k Views
    C
    @ytx-cash void amsSupport::loadRentalForms() { QSqlQuery sql; QString sqlStatement = "SELECT * FROM RENTALS ORDER BY `Order Number` DESC "; QTreeWidgetItem * child = nullptr; QStringList header, parentString, childList; QString previousClass=nullptr; int row = -1; ui->amsSupportTreeViewWidget->clear(); // Clear the widget if(sql.exec(sqlStatement)) { header << "Order Number" << "Order Date" << "Customer Name" << "Equipment" << "Serial Number" << "Stock Number" << "Sales Person" << "Store Location" << "Status" << "Remarks"; ui->amsSupportTreeViewWidget->setHeaderLabels(header); while(sql.next()) { QString className = sql.value(0).toString(); if(previousClass != className) { parentString << sql.value("Order Number").toString() << sql.value("Order Date").toString() << sql.value("Customer Name").toString(); QTreeWidgetItem *item = new QTreeWidgetItem(parentString); ui->amsSupportTreeViewWidget->addTopLevelItem(item); previousClass = className; parentString.clear(); row++; } childList << " -> "; childList << sql.value("Order Date").toString(); childList << sql.value("Customer Name").toString(); childList << sql.value("Equipment").toString(); childList << sql.value("Serial Number").toString(); childList << sql.value("Stock Number").toString(); childList << sql.value("Sales Person").toString(); childList << sql.value("Store Location").toString(); childList << sql.value("Status").toString(); childList << sql.value("Remarks").toString(); child = new QTreeWidgetItem(childList); child->setFlags(child->flags() | Qt::ItemIsUserCheckable); ui->amsSupportTreeViewWidget->topLevelItem(row)->addChild(child); childList.clear(); } } else { log_error(); } } What this does is pull my rental order numbers then adds them to the item based tree view widget one by one until the order number changes then starts a new row. Here is the outcome [image: 8d2c6ca2-d9d1-4923-9f5b-b70a911cbc9f.png] I'm sure by now there are better methods of doing this but this is what I did and its been working fine. Good luck!
  • QMediaPlayer and network files on Windows

    Unsolved
    1
    0 Votes
    1 Posts
    199 Views
    No one has replied
  • QT Docs

    Unsolved
    1
    0 Votes
    1 Posts
    135 Views
    No one has replied
  • Minimum height of QTableView

    Solved
    7
    0 Votes
    7 Posts
    1k Views
    PerdrixP
    @Perdrix Problem solved - there was a minimum size on the QDockWidget that was set. I adjusted that and all appears good now! Thanks, D
  • 0 Votes
    1 Posts
    124 Views
    No one has replied