PDA

View Full Version : By default TreeWidget width setting in DockWidget



santosh.kumar
31st May 2007, 05:55
Hi

I m creating one application within wihich I m creating some toolbar,one leftDockWidget and one bottom treeWidget.LeftDockWidget contains one treeWidget.First time CentralWidget contains label ....so that it sliding across horizontaally...second time when i m clicking on tootlbar a new treeWidget inside lefttreeWidget will come and one other treeWidget inside CentralWidget will come........but problem is that starting treeWidget contains width 512 but central Widget start from around 100 x-position but for second time central Widget start from 512 x-position...can I start this central widget from 100 x-position so that it will look like same default position...

////starting this function will call...

void StellarPhoenixMAC::showDiskTreeView()
{
QDiskTreeView *m_pStartTree = NULL;
m_pStartTree = new QDiskTreeView(0);

m_pStartTree->GetLogicalVolumes();
m_pStartTree->ShowDrives();

m_pFileViewLabel = new QLabel;
m_pFileViewLabel->setPixmap(QPixmap(":/images/img_MainScreen.png"));
m_pFileViewLabel->setMinimumHeight(450);
m_pFileViewLabel->setMinimumWidth(100);
m_pFileViewLabel->setFrameStyle(QFrame::Box | QFrame::Sunken);
m_pFileViewLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);

setCentralWidget(m_pFileViewLabel);

if(m_pDiskViewDockWidget == NULL)
m_pDiskViewDockWidget = new QDockWidget(tr(""),this);

m_pDiskViewDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea);
m_pDiskViewDockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
m_pDiskViewDockWidget->setWidget(m_pStartTree->m_pDiscTreeWidget);

addDockWidget(Qt::LeftDockWidgetArea,m_pDiskViewDo ckWidget);
actionShow_Drive_List->setEnabled(false);
displayStatusMessage();
connect(m_pStartTree->m_pDiscTreeWidget,SIGNAL(itemDoubleClicked(QTreeWi dgetItem*, int)),this,SLOT(showSearchScanDialog(QTreeWidgetIt em*, int)));
}

when clicking on toolbar....this slot wil come

void StellarPhoenixMAC::UpdateFilesTreeView()
{
//create fileTree,fileListView,DockWidget
QFileListView *m_pFileListView = NULL;
m_pFileListView = new QFileListView(this);

QFileFolderView *m_pFileFolderTree = NULL;
m_pFileFolderTree = new QFileFolderView(this);


setCentralWidget(m_pFileListView->m_pFileListTreeView);

m_pDiskViewDockWidget->setWidget(m_pFileFolderTree->m_pFileFolderTree);
actionShow_Drive_List->setEnabled(true);
createStatusBar();
update();
}

if anybody know tell me what is the problem...can i use it in other ways...