<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Help on Animated side tap option sliding dialog]]></title><description><![CDATA[<p dir="auto">Hi everyone once again.  Today, I would like to seek help to materialize the side tap option sliding dialog.</p>
<p dir="auto">The problem occurs when I decided to move the dialog to other screen position. There is no problem with the initial setup and execution. BUT, as soon as I move the main dialog to another screen position AND execute, the sub-dialog remains on the initial setup position. (This means that it does not attached together with the main dialog, which is the problem)</p>
<p dir="auto">Thus, I believe that I am lacking on the skill to 'bridge'/link values  OR at least finding the 'moved'/updated position value into the setGeometry or position setting function. Please look at my code for clarity :)  Thank you and looking forward for the community help.</p>
<pre><code>//mainwindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include &lt;QMainWindow&gt;
#include &lt;QPropertyAnimation&gt;
#include "SubDisplay_1.h"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    void AdjustGeometryFunc(int SDposx = 300, int SDposy=300, int SDwidth=0, int SDheight=0);

private:
    Ui::MainWindow *ui;

    QPropertyAnimation *animation;

private slots:
    void openPanel();
};

#endif // MAINWINDOW_H

</code></pre>
<pre><code>//Sub_Display_1.h
#ifndef SubDisplay_1_H
#define SubDisplay_1_H

#include &lt;QDialog&gt;
#include &lt;QPropertyAnimation&gt;
#include &lt;QTimer&gt;
#include "mainwindow.h"

namespace Ui {
class SubDisplay_1;
}

class SubDisplay_1 : public QDialog
{
    Q_OBJECT

public:
    explicit SubDisplay_1(QWidget *parent = 0);
    ~SubDisplay_1();

private slots:
    void panelMovementToOri();

private:
    Ui::SubDisplay_1 *ui;
    bool marker = 0;

    SubDisplay_1 *Secdialog;
    QTimer *tim;

    int initialxpos;
    int initialypos;
    int finalxpos;
    int finalypos;
};

#endif // SubDisplay_1_H

</code></pre>
<pre><code>//main.cpp
#include "mainwindow.h"
#include &lt;QApplication&gt;

int main(int argc, char *argv[])
{
  QApplication a(argc, argv);
  MainWindow w;
  w.show();

  return a.exec();
}

</code></pre>
<pre><code>//mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "SubDisplay_1.h"
#include "SubDisplay_2.h"

#include &lt;QDebug&gt;


MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui-&gt;setupUi(this);

    MainWindow::AdjustGeometryFunc();
    connect(ui-&gt;pushButton_1,SIGNAL(released()),this,SLOT(openPanel()));
    connect(ui-&gt;pushButton_2,SIGNAL(released()),this,SLOT(openPanel()));
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::AdjustGeometryFunc(int SDposx, int SDposy, int SDwidth, int SDheight){
    MainWindow::setGeometry(SDposx, SDposy, this-&gt;width(),this-&gt;height());
    qDebug() &lt;&lt; "SDposx" &lt;&lt; SDposx;
    qDebug() &lt;&lt; "SDposy" &lt;&lt; SDposy;
}

void MainWindow::openPanel()
{
    QPushButton * button = (QPushButton*)sender();
    if (button-&gt;text() == "pushbutton_1"){
    SubDisplay_1 SecDialog(this);
    SecDialog.setModal(false);
    SecDialog.exec();

    int initialxpos = MainWindow::frameGeometry().x();
    int initialypos = MainWindow::frameGeometry().y();
    qDebug() &lt;&lt; "initialxpos" &lt;&lt; initialxpos; //this position value will update
    qDebug() &lt;&lt; "initialypos" &lt;&lt; initialypos; //this position value will update

    }
}

</code></pre>
<pre><code>//SubDisplay_1.cpp
#include "SubDisplay_1.h"
#include "ui_SubDisplay_1.h"
#include "mainwindow.h"

#include &lt;QTimer&gt;
#include &lt;QDebug&gt;

SubDisplay_1::SubDisplay_1(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::SubDisplay_1)
{
    ui-&gt;setupUi(this);

    MainWindow mw;
    initialxpos = mw.frameGeometry().x(); //PROBLEM: this is not updated. remain with initial setup value
    initialypos = mw.frameGeometry().y(); //PROBLEM: //PROBLEM: this is not updated. remain with initial setup value
    finalxpos = initialxpos - SubDisplay_1::width();
    finalypos = initialypos;

    qDebug() &lt;&lt; "Subinitialxpos" &lt;&lt; initialxpos;
    qDebug() &lt;&lt; "Subinitialypos" &lt;&lt; initialypos;

    tim = new QTimer;
    tim-&gt;setInterval(1900);
    tim-&gt;start();

    if(marker==0)
        {
            QPropertyAnimation *animation = new QPropertyAnimation(this, "geometry");
            animation-&gt;setDuration(5000);
            animation-&gt;setStartValue(QRect(initialxpos, initialypos, this-&gt;width(), this-&gt;height()));
            animation-&gt;setEndValue(QRect(finalxpos, finalypos, this-&gt;width(), this-&gt;height()));
            animation-&gt;start();
            marker = 1;
        }

    connect(ui-&gt;pushButton_5,SIGNAL(released()),this,SLOT(panelMovementToOri()));
}

void SubDisplay_1::panelMovementToOri(){
    if (marker==1)
        {

            QPropertyAnimation *animation = new QPropertyAnimation(this, "geometry");
            animation-&gt;setDuration(5000);
            animation-&gt;setStartValue(QRect(finalxpos, finalypos, this-&gt;width(), this-&gt;height()));
            animation-&gt;setEndValue(QRect(initialxpos, initialypos, this-&gt;width(), this-&gt;height()));
            animation-&gt;start();
            marker = 0;
            connect(tim,SIGNAL(timeout()),this,SLOT(close()));
        }
}

SubDisplay_1::~SubDisplay_1()
{
    delete ui;
}
</code></pre>
]]></description><link>https://forum.qt.io/topic/91066/help-on-animated-side-tap-option-sliding-dialog</link><generator>RSS for Node</generator><lastBuildDate>Sun, 20 Sep 2026 19:29:43 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/91066.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 26 May 2018 07:07:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Help on Animated side tap option sliding dialog on Thu, 31 May 2018 07:52:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mrjj">@<bdi>mrjj</bdi></a> yup! my work is no longer in stale mode! I am working out and letting you know once I am done. Thank you! :) <em>Rushing to finish and make you proud</em></p>
]]></description><link>https://forum.qt.io/post/461208</link><guid isPermaLink="true">https://forum.qt.io/post/461208</guid><dc:creator><![CDATA[Faruq]]></dc:creator><pubDate>Thu, 31 May 2018 07:52:28 GMT</pubDate></item><item><title><![CDATA[Reply to Help on Animated side tap option sliding dialog on Thu, 31 May 2018 06:02:37 GMT]]></title><description><![CDATA[<p dir="auto">Hi<br />
There is always parent() call in any widget if you are inside other remember function.<br />
this-&gt;parent() gives parent for any widget. ( it can be NULL)</p>
<p dir="auto">So in mainwindow, you press button to close MyDialog ?</p>
]]></description><link>https://forum.qt.io/post/461192</link><guid isPermaLink="true">https://forum.qt.io/post/461192</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Thu, 31 May 2018 06:02:37 GMT</pubDate></item><item><title><![CDATA[Reply to Help on Animated side tap option sliding dialog on Thu, 31 May 2018 03:17:03 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mrjj">@<bdi>mrjj</bdi></a> I think I got it! But I would still require someone to verify if I am making sense.</p>
<p dir="auto">I place in connect button into the MyDialog::MyDialog and it finally pull off the close button.  I believe it works because this specific function have its parent declare on top while the other functions (Void MyDialog:: "the rest of it") doesnt have the parent declaration.  How can I declare so that the whole file can see "Parent" as a declared variable? Must i put it in the mydialog.h Header file?</p>
<p dir="auto">mydialog.cpp</p>
<pre><code>#include "mydialog.h"
#include "ui_mydialog.h"
#include "mainwindow.h"

#include &lt;QDebug&gt;

MyDialog::MyDialog(QWidget* parent) :
  QDialog(parent),
  ui(new Ui::MyDialog) {
  ui-&gt;setupUi(this);

  this-&gt;setGeometry(parent-&gt;geometry().x()-(this-&gt;width()), parent-&gt;geometry().y(),this-&gt;width(),this-&gt;height());

  connect(parent, SIGNAL(closetab()),this,SLOT(close()));

// THE MOST IMPORTANT PART IS THE CONNECT. I believe it works because this specific function have its parent declare on top while the //other functions (Void MyDialog:: -the rest of it- doesnt have the parent declaration. 
}

</code></pre>
]]></description><link>https://forum.qt.io/post/461186</link><guid isPermaLink="true">https://forum.qt.io/post/461186</guid><dc:creator><![CDATA[Faruq]]></dc:creator><pubDate>Thu, 31 May 2018 03:17:03 GMT</pubDate></item><item><title><![CDATA[Reply to Help on Animated side tap option sliding dialog on Thu, 31 May 2018 01:56:14 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mrjj">@<bdi>mrjj</bdi></a> Hi mrjj! I tried it out however there are some other parts that I am unable to pull off such as closing the newly created dialog through modeless window/dialog. The //ADDED is the modification.</p>
<p dir="auto"><a href="https://www.dropbox.com/s/pcmjsv9fx6ydz68/Faruq.myotherdialog.zip?dl=0" target="_blank" rel="noopener noreferrer nofollow ugc">https://www.dropbox.com/s/pcmjsv9fx6ydz68/Faruq.myotherdialog.zip?dl=0</a></p>
<p dir="auto">Thank you and patiently waiting for your help :)</p>
]]></description><link>https://forum.qt.io/post/461183</link><guid isPermaLink="true">https://forum.qt.io/post/461183</guid><dc:creator><![CDATA[Faruq]]></dc:creator><pubDate>Thu, 31 May 2018 01:56:14 GMT</pubDate></item><item><title><![CDATA[Reply to Help on Animated side tap option sliding dialog on Wed, 30 May 2018 14:01:15 GMT]]></title><description><![CDATA[<p dir="auto">Hi<br />
You cannot connect to inner widgets. Besides being bad design, its<br />
not possible as the UI is private.<br />
You can use signal and slots for it.<br />
You can easy add new public signals and the outside can use those.</p>
<p dir="auto">Here is sample that pops a dialog that then ask mainwindow to change a tab on<br />
a widget it holds.<br />
Same method can be used for for any kind of activation from one class to other.</p>
<p dir="auto"><a href="https://www.dropbox.com/s/w1qo7xpjhhxjzhi/myotherdialog.zip?dl=0" target="_blank" rel="noopener noreferrer nofollow ugc">https://www.dropbox.com/s/w1qo7xpjhhxjzhi/myotherdialog.zip?dl=0</a></p>
]]></description><link>https://forum.qt.io/post/461056</link><guid isPermaLink="true">https://forum.qt.io/post/461056</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Wed, 30 May 2018 14:01:15 GMT</pubDate></item><item><title><![CDATA[Reply to Help on Animated side tap option sliding dialog on Tue, 29 May 2018 16:36:07 GMT]]></title><description><![CDATA[<p dir="auto">Anyone have any idea? Currently I am working/replacing the connect with these but to no avail:</p>
<ol>
<li>
<p dir="auto">connect(parent-&gt;pushButton_2,SIGNAL(released()), this, SLOT(panelMovementToOri()));</p>
</li>
<li>
<p dir="auto">connect(MainWindow::ui-&gt;pushButton_2,SIGNAL(released()), this, SLOT(panelMovementToOri()));</p>
</li>
<li>
<p dir="auto">Ui::MainWindow *ui123 ;      (UNDER HEADER PUBLIC)<br />
connect(ui123.pushButton_2,SIGNAL(released()), this, SLOT(panelMovementToOri()));</p>
</li>
</ol>
<p dir="auto">All of the above doesn't work as it says something along  Error: invalid use of non-static data member  or some other error.</p>
<p dir="auto">All I need is to connect to the parent/other ui object QPushButton from this current .ccp file. Thus the missing blank would be as follows;</p>
<p dir="auto">aaa.cpp<br />
There is a QPushButton here. namely PushButton_1.</p>
<p dir="auto">bbb.cpp<br />
connect( ?????????  ,SIGNAL(released()), this, SLOT(panelMovementToOri()));</p>
<p dir="auto">where the ??? is the missing blank.</p>
]]></description><link>https://forum.qt.io/post/460868</link><guid isPermaLink="true">https://forum.qt.io/post/460868</guid><dc:creator><![CDATA[Faruq]]></dc:creator><pubDate>Tue, 29 May 2018 16:36:07 GMT</pubDate></item><item><title><![CDATA[Reply to Help on Animated side tap option sliding dialog on Tue, 29 May 2018 09:51:37 GMT]]></title><description><![CDATA[<p dir="auto">On top of the above,<br />
how do I access a child Ui objects (E.g. pushButton, etc) and their function from its parent .cpp?</p>
]]></description><link>https://forum.qt.io/post/460800</link><guid isPermaLink="true">https://forum.qt.io/post/460800</guid><dc:creator><![CDATA[Faruq]]></dc:creator><pubDate>Tue, 29 May 2018 09:51:37 GMT</pubDate></item><item><title><![CDATA[Reply to Help on Animated side tap option sliding dialog on Tue, 29 May 2018 03:48:47 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mrjj">@<bdi>mrjj</bdi></a> I decided to continue on and encountered another problem.</p>
<p dir="auto">I am trying to access the parent ui pushButton from SubDisplay_1 (.cpp number 2).</p>
<p dir="auto">the code I used is;<br />
connect(parent-&gt;pushButton_2,SIGNAL(released()), this, SLOT(panelMovementToOri()));</p>
<p dir="auto">However, parent seems to only work with adjustment and NOT to access their pushButtons or so. (Ui Objects). Did I miss out something or a step?</p>
]]></description><link>https://forum.qt.io/post/460729</link><guid isPermaLink="true">https://forum.qt.io/post/460729</guid><dc:creator><![CDATA[Faruq]]></dc:creator><pubDate>Tue, 29 May 2018 03:48:47 GMT</pubDate></item><item><title><![CDATA[Reply to Help on Animated side tap option sliding dialog on Sat, 26 May 2018 14:09:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mrjj">@<bdi>mrjj</bdi></a> IT WORKSSSSSSSSSSSSSS!!!!  OMG THANKS.</p>
]]></description><link>https://forum.qt.io/post/460378</link><guid isPermaLink="true">https://forum.qt.io/post/460378</guid><dc:creator><![CDATA[Faruq]]></dc:creator><pubDate>Sat, 26 May 2018 14:09:33 GMT</pubDate></item><item><title><![CDATA[Reply to Help on Animated side tap option sliding dialog on Sat, 26 May 2018 09:30:50 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/faruq">@<bdi>Faruq</bdi></a><br />
Hi, good to hear.</p>
<p dir="auto">The parent is part of the ownership system.<br />
<a href="http://doc.qt.io/qt-5/objecttrees.html" target="_blank" rel="noopener noreferrer nofollow ugc">http://doc.qt.io/qt-5/objecttrees.html</a><br />
Its used both or Qt to know how the widgets on the screen is related and used for<br />
drawing. ( if parent is hidden, all child are hidden too etc)<br />
Its also used for cleaning up. Normally in c++ when you new something , you have to call delete on it<br />
or you leak memory. Qt helps to make that easier, and the ownership system is used to keep track of<br />
of the children and its owners will delete them.<br />
So when you insert say a QPushButton on Window. When window is deleted, it deletes the button too.<br />
(so you dont have to )</p>
<p dir="auto">The key is to assign a parent/owner when you create them<br />
QPushButton *b  = new QPushButton(this) &lt;&lt; this being mainwindow<br />
then its shown correctly and also being delete with Mainwindow. ( that main.cpp will delete)</p>
]]></description><link>https://forum.qt.io/post/460347</link><guid isPermaLink="true">https://forum.qt.io/post/460347</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Sat, 26 May 2018 09:30:50 GMT</pubDate></item><item><title><![CDATA[Reply to Help on Animated side tap option sliding dialog on Sat, 26 May 2018 09:21:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mrjj">@<bdi>mrjj</bdi></a> thank you so much :( you have no idea how much relief I have to see a constructive remark/ help. I will look into it right after I'm done with my errands.</p>
<p dir="auto">Hmm is there any good tutorial on parents? I think linkage( knowing to link) between source file and header file especially in QT is very necessary.</p>
]]></description><link>https://forum.qt.io/post/460346</link><guid isPermaLink="true">https://forum.qt.io/post/460346</guid><dc:creator><![CDATA[Faruq]]></dc:creator><pubDate>Sat, 26 May 2018 09:21:23 GMT</pubDate></item><item><title><![CDATA[Reply to Help on Animated side tap option sliding dialog on Sat, 26 May 2018 08:48:54 GMT]]></title><description><![CDATA[<p dir="auto">Hi</p>
<p dir="auto">I think the issue comes from the fact you make a new mainwindow</p>
<pre><code>
ubDisplay_1::SubDisplay_1(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::SubDisplay_1)
{
    ui-&gt;setupUi(this);

    MainWindow mw; &lt;&lt;&lt;&lt;&lt; thats a new copy 
</code></pre>
<p dir="auto">so when you move the real one, this copy is still in default pos.</p>
<p dir="auto">Why dont you just use the parent parameter ?</p>
<p dir="auto">In mainwin, you do<br />
SubDisplay_1 SecDialog(this);</p>
<p dir="auto">so "this" is already mainwindow.</p>
<p dir="auto">the new copy (mw) is not needed and will stay the same always.</p>
<p dir="auto">so try</p>
<pre><code>   if( ! parent ) return; // if NULL u crash :)
    initialxpos = parent-&gt;frameGeometry().x(); //PROBLEM: this is not updated. remain with initial setup value
    initialypos = parent-&gt;frameGeometry().y(); //
</code></pre>
<p dir="auto">as it will then BE the real mainwindow and have the new positions.<br />
unlike now where is a invisible copy and always have the same default position.</p>
<p dir="auto">That is my guess :)</p>
]]></description><link>https://forum.qt.io/post/460344</link><guid isPermaLink="true">https://forum.qt.io/post/460344</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Sat, 26 May 2018 08:48:54 GMT</pubDate></item></channel></rss>