this is my .h file
#ifndef MYTCPSOCKET_H
#define MYTCPSOCKET_H
#include <QMainWindow>
#include <QTcpSocket>
#include <QUdpSocket>
#include <QAbstractSocket>
#include <QProcess>
#include <QDebug>
#include <QMediaPlayer>
#include <QVideoWidget>
#include <QProcess>
namespace Ui {
class MyTcpSocket;
class ClickableVideo;
}
class ClickableVideo : public QVideoWidget
{
Q_OBJECT
public:
ClickableVideo
(QWidget *parent
= 0) : QVideoWidget
(parent
) { m_pParent = parent;
maxMode = false;
maxMode1 = false;
maxMode2 = false;
maxMode3 = false;
connect(this, SIGNAL(clicked()), this, SLOT(slotClicked()));
}
bool maxMode,maxMode1,maxMode2,maxMode3;
Qt::WindowFlags m_enOrigWindowFlags;
signals:
void clicked(void);
void reconnect(void);
public slots:
void slotClicked();
protected:
void mouseReleaseEvent
(QMouseEvent* event
) // or double clicked or what you want {
emit this->clicked();
}
private:
Ui::ClickableVideo *ui;
};
{
Q_OBJECT
public:
explicit MyTcpSocket
(QWidget *parent
= 0);
~MyTcpSocket();
void doConnect();
void rtp_to_frame_splitter
(QByteArray &received_data
);
private:
Ui::MyTcpSocket *ui;
signals:
public slots:
void connected();
void disconnected();
void reconnect_widget();
void bytesWritten(qint64 bytes);
void readyRead();
void on_pushButton_clicked();
void on_pushButton_4_clicked();
private:
QMediaPlayer *player1;
QMediaPlayer *player2;
QMediaPlayer *player3;
QMediaPlayer *player4;
ClickableVideo *videoWidget1;
ClickableVideo *videoWidget2;
ClickableVideo *videoWidget3;
ClickableVideo *videoWidget4;
};
#endif // MYTCPSOCKET_H
#ifndef MYTCPSOCKET_H
#define MYTCPSOCKET_H
#include <QMainWindow>
#include <QTcpSocket>
#include <QUdpSocket>
#include <QAbstractSocket>
#include <QProcess>
#include <QDebug>
#include <QMediaPlayer>
#include <QVideoWidget>
#include <QProcess>
namespace Ui {
class MyTcpSocket;
class ClickableVideo;
}
class ClickableVideo : public QVideoWidget
{
Q_OBJECT
public:
ClickableVideo(QWidget *parent = 0) : QVideoWidget(parent) {
m_pParent = parent;
maxMode = false;
maxMode1 = false;
maxMode2 = false;
maxMode3 = false;
connect(this, SIGNAL(clicked()), this, SLOT(slotClicked()));
}
QWidget* m_pParent;
bool maxMode,maxMode1,maxMode2,maxMode3;
Qt::WindowFlags m_enOrigWindowFlags;
QSize m_pSize;
signals:
void clicked(void);
void reconnect(void);
public slots:
void slotClicked();
protected:
void mouseReleaseEvent(QMouseEvent* event) // or double clicked or what you want
{
emit this->clicked();
}
private:
Ui::ClickableVideo *ui;
};
class MyTcpSocket : public QMainWindow
{
Q_OBJECT
public:
explicit MyTcpSocket(QWidget *parent = 0);
~MyTcpSocket();
void doConnect();
void session_splitter(QByteArray &received_data);
void rtp_to_frame_splitter(QByteArray &received_data);
private:
Ui::MyTcpSocket *ui;
signals:
public slots:
void connected();
void disconnected();
void reconnect_widget();
void bytesWritten(qint64 bytes);
void readyRead();
void on_pushButton_clicked();
void on_pushButton_4_clicked();
private:
QProcess *mInputPlayProcess;
QTcpSocket *socket;
QTcpSocket *send_socket;
QMediaPlayer *player1;
QMediaPlayer *player2;
QMediaPlayer *player3;
QMediaPlayer *player4;
ClickableVideo *videoWidget1;
ClickableVideo *videoWidget2;
ClickableVideo *videoWidget3;
ClickableVideo *videoWidget4;
};
#endif // MYTCPSOCKET_H
To copy to clipboard, switch view to plain text mode
In my mytcpsocket.cpp file I have implemented the slot like this
void ClickableVideo::slotClicked()
{
//QObject *pobj;
//pobj = this->sender();
//QString str = pobj->objectName();
//if(str == "videoWidget1")
//{
if (maxMode== false)
{
//this->setParent(0);
this->showFullScreen();
maxMode = true;
}
else
{
emit this->reconnect();
this->showNormal();
maxMode = false;
}
//}
}
void ClickableVideo::slotClicked()
{
//QObject *pobj;
//pobj = this->sender();
//QString str = pobj->objectName();
//if(str == "videoWidget1")
//{
if (maxMode== false)
{
//this->setParent(0);
this->showFullScreen();
maxMode = true;
}
else
{
emit this->reconnect();
this->showNormal();
maxMode = false;
}
//}
}
To copy to clipboard, switch view to plain text mode
Two additional things I want to ask:
The objectname doesn't give me a name because videowidget is not part of the Ui file. So how can I seperate out between various widgets.
And if I uncomment setparent(0) it goes to fullscreen but as it was happening earlier comes back to normal size in another window!
Please Help!
Added after 47 minutes:
Also why isn't this connection working?
connect(videowidget1,SIGNAL(reconnect()),this,SLOT (reconnect_widget()));
This has been done in the constructor of mytcpsocket but it isn't going to the slot on emitting the signal? Why?
Bookmarks