Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.9k Posts
  • Self-destructing Singleton Inheritance

    3
    0 Votes
    3 Posts
    3k Views
    G
    Yes, I don't need to inherit from QObject, this was just to accomodate signals/slots. But it doesn't matter here. Yes, Singleton<MyClass>::instance() will also work, but I want to encapsulate that. So a programmer can simply call MyClass::instance(), without even knowing/worrying about a super class (aka Singleton).
  • Painting on qimage or qpixmap taking time in real time plotting

    5
    0 Votes
    5 Posts
    8k Views
    S
    Greetings sushmars, I am working on a similar task these days - trying to accomplish best quality plot for ECG signal from physionet.org signals database. Have you succeed to plot the data as required ? Can you share the code for your application ? ( here or in private message ) If not, could that be purchased if yes how much does it cost ? Thanks, Paul swdev@ovi.com
  • MYSQL Drivers - How to install on Mac osx 10.7?

    6
    0 Votes
    6 Posts
    6k Views
    P
    finally worked it out!! final step after all of that you need to run the install-name-tool: @install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient_r.18.dylib libqsqlmysql.dylib@
  • 0 Votes
    4 Posts
    8k Views
    N
    I've managed to come up with a solution. QEvent has a static public function called registerEventType which can be used to create a new event type. Rather than trying to cast the QEvent going into the changeEvent, I have simply registered a new type of event, rather than trying to determine the state of the window before and after maximization/un-maximization. My solution is: @class MainWindow : public QMainWindow { //Some stuff //The enum value must be between 1000 and 65535 in order not to clash with existing event types enum MainWindowEvent { Maximise = 3000, UnMaximise = 3001 }; // Some more stuff }; void MainWindow::maximiseButtonClicked() { // Some stuff emit mainWindowMaximised(); // Some more stuff } void MainWindow::mainWindowMaximised() { QEvent::Type type::registerEventType( MainWindowEvent::Maximise ); QEvent *e = new QEvent( type ); changeEvent(e); } void MainWindow::changeEvent( QEvent *e ) { if( e->type == MainWindowEvent::Maximise ){ //Do something with the newly maximised window } else if( e->type() == MainWindowEvent::Unmaximise) { //Do something with the newly unmaximised window } }@ }
  • Qtimer object blocking an application.

    5
    0 Votes
    5 Posts
    6k Views
    T
    [quote author="Lukas Geyer" date="1339491711"]Is it possible that your timeout value is too low (for the amount of work that has to be done in the connected slots) so the timer runs out consecutively and thus your applications thrashes and blocks?[/quote] Oh. Yes. You may review your interval and slots, which connected with timer. It can be very small amount of time for hard work in slots, so they can be running all the time (without interval).
  • QGraphicsView hit test region on Linux

    2
    0 Votes
    2 Posts
    3k Views
    napajejenunedk0N
    The only solution available for the moment is the last post in "this":http://www.qtcentre.org/threads/28197-Click-through-window thread: @#include <QX11Info> #include <X11/Xlib.h> #include <X11/extensions/shape.h> MyWidget::MyWidget() : QWidget() { QRegion region; XShapeCombineRegion( QX11Info::display(), winId(), ShapeInput, 0, 0, region.handle(), ShapeSet ); }@ The problem with this code is that if the user interface is dynamic - created from movable QGraphicsItem-based controls, one should periodically do the following: create a ARGB32 QImage and paint the whole UI there create a mask out of the QImage where the black color indicates the opaque and semi-transparent areas and the white color - the fully transparent ones convert the mask it to QPixmap create a QRegion out of the QPixmap mask The aforementioned procedure adds significant overhead to the Linux version of the application. Is there any Qt integrated way to perform this mouse input transparency?
  • Can't find linker symbol for virtual table for 'QMutexLocker' value

    2
    0 Votes
    2 Posts
    3k Views
    M
    Are those two errors from the same run? Because if the symbol cannot be found, that is (dynamic) link time error, while the error from QMutex::lock() is a runtime error. If they are from the same run, it looks like your app is picking up a different Qt library than you link your project with.
  • Does a running timer in the event loop prevent app from terminating?

    2
    0 Votes
    2 Posts
    2k Views
    M
    I am quite certain that a pending timer does not prevent the event loop from exiting.
  • How to solve error LNK2001: unresolved external symbol?

    2
    0 Votes
    2 Posts
    5k Views
    T
    Try to clean project and review your meta-information.
  • QGraphicsScene problem

    6
    0 Votes
    6 Posts
    7k Views
    M
    Hi,I've made the several change on my programe at EERTView.h @#ifndef EERTVIEW_H #define EERTVIEW_H #include<QGraphicsView> #include<QGraphicsScene> #include<QGraphicsItem> #include<QWidget> #include<QtGui> class EERTPoly; class EERTView : public QGraphicsView { Q_OBJECT public: explicit EERTView(QWidget *parent = 0); signals: public slots: protected: void mousePressEvent ( QMouseEvent * event ); private: EERTPoly* polygonItem; QPolygonF polygom; }; #endif // EERTVIEW_H @ EERTView.cpp @#include "EERTView.h" #include "EERTPoly.h" #include<QGraphicsView> EERTView::EERTView(QWidget *parent) : QGraphicsView(parent) { QGraphicsScene *scene = new QGraphicsScene(); // scene->setItemIndexMethod(QGraphicsScene::NoIndex); scene->setSceneRect(0, 0, 400, 400); scene->setBackgroundBrush(Qt::yellow); setScene(scene); // EERTPoly polygonItem=NULL; // polygonItem=new EERTPoly; EERTPoly polygonItem=new EERTPoly(polygonItem); } void EERTView::mousePressEvent ( QMouseEvent * event ){ if(event->button() == Qt::LeftButton) { // polygonItem->polygon(); polygom.append(QPointF(event->pos().x(),event->pos().y())); // polygonItem->polygon().append(QPointF(event->pos().x(), event->pos().y())); } // polygonItem->polygon().append(QPointF(event->pos().x(), event->pos().y())); //// markList.append(new GraphMarkItemCustom(QPointF(event->pos().x(), event->pos().y()))); //// ptr = markList.last(); //// markGroup->addToGroup(ptr); // //this->scene()->addItem(ptr); // } // if (event->button() == Qt::LeftButton) // { // polygonItem= event->pos(); //// polygonItem=setpos; //// QListWidget::mousePressEvent(event); // } if(event->button()==Qt::RightButton) { // SuperItem *super=NULL; // super=new SuperItem; // scene->addItem(super); this->scene()->addItem(polygonItem); polygonItem->setFocus(); // scene.addItem(polygonItem); } } @ EERTPoly.h @#ifndef EERTPOLY_H #define EERTPOLY_H #include <QGraphicsPolygonItem> class EERTView; class EERTPoly : public QGraphicsPolygonItem { Q_OBJECT public: explicit EERTPoly( QGraphicsItem * parent = 0); QPolygonF polygon () const; virtual QRectF boundingRect () const; virtual void paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 ); void setPolygon(const QPolygonF &polygon); signals: public slots: protected: QPolygonF polygom; }; #endif // EERTPOLY_H @ EERTPoly.cpp @#include "EERTPoly.h" #include <QtGui/QPainter> EERTPoly::EERTPoly( QGraphicsItem * parent = 0) : QGraphicsPolygonItem(parent) { // setFlag(QGraphicsPolygonItem::ItemIsFocusable); // QGraphicsPolygonItem* polygonItem=new QGraphicsPolygonItem(polygonItem); } void EERTPoly::setPolygon(const QPolygonF &polygon) { this->setPolygon(polygon); } QPolygonF EERTPoly::polygon () const { return QPolygonF; } QRectF EERTPoly::boundingRect () const { return ploygonItem.boundingRect(); } void EERTPoly::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 ) { painter->drawPolygon(boundingRect()); } @ but It's Give me the following error 1.Default argument was given parameter 1'EERTPoly::EERTPoly(*QGraphicsItem)' 2.after previous specification in 'EERTPoly::EERTPoly(*QGraphicsItem)' in the memeber function in 'QPolygonF EERTPoly::polygon() const' 3.expected primary expression ';' in the member function 'QPolygonF EERTPoly::polygon () const' 4.'polygonItem' was not declared in this scope 5.default argument given 'EERTPoly::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 )' 6.after previous specification in ' virtual void paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 );' actuallt I want to draw a polygon on the scene when I clicked on the scene .the polygon point was store in the void EERTView::mousePressEvent ( QMouseEvent * event ) function.can anyone plz help me to do so
  • Password validation in case of multilanguage application

    5
    0 Votes
    5 Posts
    2k Views
    C
    Your original question was about checking that a supplied password matches a stored one: bq. The boot up screen is having password field. On entry of password: validation of password happens & on entry of correct password: user is able to see main window. That process is independent of language. Now it seems that when you said "validating password" you meant checking that a new supplied password was "adequately" strong. Any printable character (QChar::isPrint() == true) the user can type is a good character for a password*. If you want to generally enforce some variety in types of characters then you could use QChar::isDigit(), isLetter(), isUpper(), isLower(), isPunct(), isSpace() and maybe even isSymbol() to determine if enough variety is present in the QString the user has given you. This removes the requirement for you to know that the Turkish alphabet has both a dotted and dotless i, the myriad of allowed accented characters in European alphabets etc. Since all your languages are alphabetic this should be adequate. Some non-printable characters could be allowed but they will cause more problems than they are worth.
  • QtCreator under arm arch (Cubox)

    4
    0 Votes
    4 Posts
    2k Views
    R
    Hello, thanks for the replies. To David, i'd like to give thanks for his interest, but I ried the package unsuccessfully. To Tobias, I will try what he proposes. Cheers
  • How can I specify the line spacing in the TableView.

    2
    0 Votes
    2 Posts
    1k Views
    JeroentjehomeJ
    Might want to take a look into the model you use. The QTableView "asks" the model how and what to display for each cell (model::data). Here the different roles give different options. Qt::FontRole might be where you are able to alter the line spacing. good luck
  • XML Digital Signature

    2
    0 Votes
    2 Posts
    3k Views
    D
    You could sign the XML data just like any other data with OpenSSL. The easiest way is probably to invoke the necessary command line program openssl, see http://www.madboa.com/geek/openssl/#cert-self . Or you could use libssl-dev directly in your program. Another possibility is to use libraries like the "XMLSecLib":http://www.aleksey.com/xmlsec/index.html, but they basically also wrap openssl. Don't confuse the XML-formatted-Signature with the signed data. There's nothing special about the data, you can sign any data you like, including XML. There might be a way to do this with the OpenSSL-Qt-Integration, but I've only come across using this with QSSLSockets (see QSslCertificate etc.).
  • Best way to reuse forms(or ui design) in a project [SOLVED]

    6
    0 Votes
    6 Posts
    7k Views
    L
    Thanks for the suggestions. I will go ahead with custom widget approach(with QtCreator plugin). Integration with QtCreator is very useful for me, as I will be doing lot of experiments with design.
  • QTabWidget - Icons disappear when tab selected

    3
    0 Votes
    3 Posts
    2k Views
    P
    Hi, sorry, the functionality was created entirely with UI designer so below I include my ui file to answer your question, I am using a resource file for the icons Below is my UI file @<widget class="QWidget" name="tab_2"> <attribute name="icon"> <iconset resource="Icons.qrc"> <normaloff>:/new/prefix1/WorkRules.png</normaloff> <normalon>:/new/prefix1/WorkRules.png</normalon> <activeoff>:/new/prefix1/WorkRules.png</activeoff> <activeon>:/new/prefix1/WorkRules.png</activeon> <selectedoff>:/new/prefix1/WorkRules.png</selectedoff> <selectedon>:/new/prefix1/WorkRules.png</selectedon>:/new/prefix1/WorkRules.png</iconset> </attribute>@
  • How to draw single line use QT Open GL?

    2
    0 Votes
    2 Posts
    3k Views
    L
    Have a look at "QtOpenGL module documentation":http://qt-project.org/doc/qt-4.8/qtopengl.html. A simple example app is available at "this similar forum thread":http://qt-project.org/forums/viewthread/4448
  • Odbc driver - can't get it work

    3
    0 Votes
    3 Posts
    2k Views
    M
    Thanks :) Works great :)
  • I need to place text in a QTextDocument in accurate coordinates

    2
    0 Votes
    2 Posts
    1k Views
    T
    Maybe the best way will be to use HTML with CSS markup? You can simply create and compose data in it.
  • Class for replacing the mouse click

    10
    0 Votes
    10 Posts
    4k Views
    B
    So you are looking to do animation then - take a look at "Qt's animation framework documentation":http://doc.qt.nokia.com/4.7-snapshot/animation-overview.html.