Skip to content
  • 0 Votes
    10 Posts
    2k Views
    C

    @SGaist Thank you! This is very helpful to know.

  • 0 Votes
    9 Posts
    943 Views
    C

    @Christian-Ehrlicher Thank you for clarifying!

  • 0 Votes
    7 Posts
    790 Views
    G

    @SGaist of course!

    This OP gave up, as I'm about to do

    while this discussion gave me hope of handling mouse events in the view myself

    This discussion didn't really go anywhere at all

  • 0 Votes
    11 Posts
    834 Views
    Q

    The issue is no longer observed with the latest Intel graphics driver beta version(27.20.100.8581). Fixed in latest release version 27.20.100.8587

  • Cross Swipe Screens

    Solved QML and Qt Quick
    4
    0 Votes
    4 Posts
    350 Views
    M

    @Matheus-da-Silva-Ribeiro Please mark your answer as "Correct Answer" to change title to "Solved".

  • 0 Votes
    5 Posts
    3k Views
    A

    After some other tests, I think I've found which is the issue and how to solve it.

    Here a simplified snippet of my code, where there is a class Button used by a class Parent.
    When button is clicked, it could cause a panel change, or raise a message, or do some other actions (not detailed beause not relevant to the question).

    What I found is in slot onClicked of class Button: entering the first if, the program emits the signal request_GoToPrev, which cause the class Panel to delete current panel (and its childs, even compirsed the Button!) and raise a new one.
    But after emitting the signal and do all actions required, the program "comes back" to the point when it has emitted the signal and continue the instruction execution: when it reaches the second if it creashes because this is no more consistent.

    That's what it seems to be after my tests. Putting a return call just after the signal emission in the first if problem is solved.

    // HEADER: Button.h class Button : public QPushButton { Q_OBJECT public: Button( QWidget *parent = 0 ); ~Button(); signals: void request_GoToPrev(); //!< Go to previous panel void request_GoToNext( QString ); //!< Go to next panel void signal_Error( int ); //!< Error code private slots: void onClicked(); private: typ_Button_tags *widgetTags; //!< Pointer to the tags structure that defines the \ref Button widget typ_Shared *privateCtx; //!< Reference to runtime application structure }; // C: Button.cpp Button::Button( QWidget *parent ) : QPushButton(parent) { // Do some settings, like: font, stylesheet, focus, size.. } Button::~Button() { } void Button::onClicked() { // Callback to be called when button clicked if( !this->widgetTags->callbackClick.isEmpty() ) { emit this->request_GoToPrev(); /* !!! ATTENTION !!! * * Here the instruction return HAS to be written, otherwise the application crashes. * In fact, when running, the signal 'request_GoToPrev' is sent, but the flow of the * process should exit the call of this slot. * Doing that, 'this' is no more consistent after having emitted the signal, so the * application face a segmentation fault. */ return; } // Message box if( !this->widgetTags->msgText.isEmpty() ) { // Do some other actions on 'this'... } } // HEADER: Panel.h class Panel : public QMainWindow { Q_OBJECT public: Panel( QWidget *parent = 0 ); private slots: void on_GoToNext(int index); void on_GoToPrevious(); void on_Error(int errId); private: Button *Btn; }; // C: Panel.h Panel::Panel( QWidget *parent ) : QMainWindow(parent) { // Do some settings: font, stylesheet, focus, size... this->Btn = new Button( this ); connect( this->Btn, SIGNAL(request_GoToPrev()), this, SLOT(on_GoToPrevious()), Qt::UniqueConnection ); // Do some actions to layout the button inside the panel } void Panel::on_GoToPrevious() { // Do some check... delete this->Btn; // Do some actions... }
  • 0 Votes
    6 Posts
    3k Views
    SGaistS

    Hi,

    Out of curiosity, why do you want to "simulate" a button click ?

  • 0 Votes
    1 Posts
    595 Views
    No one has replied
  • 0 Votes
    11 Posts
    17k Views
    BuckwheatB

    Hi @Andrea

    WOW! Infinite loop to just sleep and process events. Why not just start a timer of PreciseTimer and allow the events to flow freely in the thread? Since you want it to run as fast as possible you can even set the timeout to 0 to run freely when there are no events.

    You can then look at thread->requestInterruption () and the thread will comply! Just make sure if you are doing something in a loop in the timer callback you check thread ()->isInterruptionRequested (). And best of all... NO CHECKING THE EVENT QUEUE!

    There is a nice writeup about proper thread use at: https://mayaposch.wordpress.com/2011/11/01/how-to-really-truly-use-qthreads-the-full-explanation/

    You are basically there with your code. Just the loop is wasteful.

  • 0 Votes
    3 Posts
    1k Views
    M

    In the PyQt 4.9.4 code downoaded from https://sourceforge.net/projects/pyqt/files/PyQt4/ I find
    (Note that we are using 4.9.3 but I couldn't find the sources of that version)

    void sipQLineEdit::changeEvent(QEvent *a0) { sip_gilstate_t sipGILState; PyObject *sipMeth; sipMeth = sipIsPyMethod(&sipGILState,&sipPyMethods[14],sipPySelf,NULL,sipName_changeEvent); if (!sipMeth) { QLineEdit::changeEvent(a0); return; } typedef void (*sipVH_QtCore_17)(sip_gilstate_t,PyObject *,QEvent *); ((sipVH_QtCore_17)(sipModuleAPI_QtGui_QtCore->em_virthandlers[17]))(sipGILState,sipMeth,a0); }
  • 0 Votes
    4 Posts
    2k Views
    S

    @jsulm many thanks. Yes libgpsmm.h is ok, but the man page you pointed to also references libQgpsmm.

  • list-elemetns are not "paint"

    Solved QML and Qt Quick
    7
    0 Votes
    7 Posts
    2k Views
    P

    Hi Ray,

    thanks for that tip. Now i understood the way how it works.
    i already tried and it works.
    thanks both of you
    -> solved

  • 0 Votes
    4 Posts
    3k Views
    SGaistS

    The Keyboard Focus in Widgets chapter from Qt's documentation already give some hints on how to handle that.

    If you build your focus chain properly you can then use nextInFocusChain and previousInFocusChain to avoid hardcoding stuff.

  • 0 Votes
    4 Posts
    5k Views
    B

    I think i've found a solution.

    First, i install an eventFilter in my custom editor widget B on the internal spinbox :

    internalSpinbox->installEventFilter(this);

    Then, i implement eventFilter to treat the events on the spinbox and duplicate them to the parent:

    bool AbstractRatioQuantitySpinbox::eventFilter(QObject *object, QEvent *event) { // cf http://stackoverflow.com/questions/12145522/why-pressing-of-tab-key-emits-only-qeventshortcutoverride-event if (event->type() == QEvent::KeyPress) { auto keyEvent = static_cast<QKeyEvent *>(event); if (keyEvent->key() == Qt::Key_Tab || keyEvent->key() == Qt::Key_Backtab) { QApplication::postEvent( this, new QKeyEvent(keyEvent->type(), keyEvent->key(), keyEvent->modifiers())); return true; } } else if (event->type() == QEvent::FocusOut) { auto focusEvent = static_cast<QFocusEvent *>(event); QApplication::postEvent(this, new QFocusEvent(focusEvent->type(), focusEvent->reason())); return false; } return QWidget::eventFilter(object, event); }
  • 0 Votes
    4 Posts
    2k Views
    SGaistS

    Maybe QNetworkConfigurationManager and friend classes might be of help here.

  • 0 Votes
    1 Posts
    927 Views
    No one has replied
  • 0 Votes
    3 Posts
    2k Views
    Y

    Thanx bsomervi. Good point. I could go with an even more general signal (like itemClicked) but finding the signal that will more rightly pick only a checkbox checked/unchecked action would be optimal.

  • Import from Odt

    Unsolved General and Desktop
    3
    0 Votes
    3 Posts
    2k Views
    P

    Odt import file is very easy...

    OOReader.h is my work, is a subset from Okular KDE ...
    https://github.com/pehohlva/fop-miniscribus/blob/master/OO_Widged/oasis/OOReader.h
    2017 the best way is now textutil from mac it convert doc rtf docx odt and many other format to txt or html to play in QTextedit ...

    void ZipDoc::handler_txtutils( const QString file ) { qDebug() << "### handler use-> " << __FUNCTION__; //// converter = /usr/bin/textutil if (converter.size() < 4) { text_s = QString("textutil -convert .. unable to read! or not mac osx."); } //// ram->LoadFile(file); //// const QByteArray base = ram->stream(); QTime myTimer; myTimer.start(); QProcess *process = new QProcess(NULL); process->setReadChannelMode(QProcess::MergedChannels); process->start(converter, QStringList() << "-convert" << "txt" << file << "-stdout", QIODevice::ReadOnly ); if (!process->waitForFinished()) { text_s = QString("Unable to read!."); } else { text_s = strip_tag(process->readAll()); } qDebug() << "### handler_txtutils time-> " << myTimer.elapsed(); }
  • 0 Votes
    3 Posts
    3k Views
    N

    Ok, even i tried copying by libraries to the deploying system, and exported it , then binary will execute, but serial port will not work as in the code.,

  • 0 Votes
    4 Posts
    2k Views
    V

    There already a camera application(qtcam) integrated qtquick and v4l2, please try clone the source from the below link,
    https://github.com/econsysqtcam/qtcam.git
    Application available in launchpad also for ubuntu 12.04 & 14.04