Bloodshedder
20th October 2015, 07:32
Hi, im new to this forum and to QT.
I consider myself a below average C++ programmer
Im trying to mergue to diferent mini projects to one. They work perfectly separated but when i merge them the program crashes.
The QDirModel was created using a Base Clase QDialog and the QMediaPlayer was created with Base class QMainWindow.
The treeview was created with a mainwindow.ui
The code goes as follows :
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
//-----------------Tree Archives
model =new QDirModel(this);
model->setReadOnly(false);
model->setSorting(QDir::DirsFirst | QDir::IgnoreCase| QDir::Name);
ui->treeView->setModel(model);
QModelIndex index= model->index("C:/");
ui-> treeView->expand(index);
ui-> treeView->scrollTo(index);
ui->treeView->setCurrentIndex(index);
ui->treeView->resizeColumnToContents(0);
//-----------------Tree Archives end
//-----------------Video Start
player = new QMediaPlayer(this);
vw=new QVideoWidget(this);
player->setVideoOutput(vw);
setGeometry(100,100,1000,700);
vw->setGeometry(10,50,640,320);
//-----------------Video Start end
Originally i thought it was a problem with the video taking up all the video space so i decided to resize it. But it didnt work.
any leads or pointers on the cause of the problem!?
Thanks!
I consider myself a below average C++ programmer
Im trying to mergue to diferent mini projects to one. They work perfectly separated but when i merge them the program crashes.
The QDirModel was created using a Base Clase QDialog and the QMediaPlayer was created with Base class QMainWindow.
The treeview was created with a mainwindow.ui
The code goes as follows :
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
//-----------------Tree Archives
model =new QDirModel(this);
model->setReadOnly(false);
model->setSorting(QDir::DirsFirst | QDir::IgnoreCase| QDir::Name);
ui->treeView->setModel(model);
QModelIndex index= model->index("C:/");
ui-> treeView->expand(index);
ui-> treeView->scrollTo(index);
ui->treeView->setCurrentIndex(index);
ui->treeView->resizeColumnToContents(0);
//-----------------Tree Archives end
//-----------------Video Start
player = new QMediaPlayer(this);
vw=new QVideoWidget(this);
player->setVideoOutput(vw);
setGeometry(100,100,1000,700);
vw->setGeometry(10,50,640,320);
//-----------------Video Start end
Originally i thought it was a problem with the video taking up all the video space so i decided to resize it. But it didnt work.
any leads or pointers on the cause of the problem!?
Thanks!