void FileBrowser::activated(const QModelIndex &index) { QFileInfo fileInfo = fileSystemModel->fileInfo(index); if (fileInfo.isDir() && fileInfo.fileName() != QLatin1String(".")) { if (fileInfo.fileName() == QLatin1String("..")) { QModelIndex parent = view->rootIndex().parent(); fileInfo = fileSystemModel->fileInfo(parent); if (fileInfo.absoluteFilePath() == rootPath) fileSystemModel->setFilter(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs); view->setRootIndex(parent); } else { fileSystemModel->setFilter(QDir::AllEntries | QDir::AllDirs); view->setRootIndex(index); } setWindowTitle(fileInfo.fileName()); } else { if (fileInfo.fileName() == QLatin1String(".")) fileInfo = fileSystemModel->fileInfo(view->rootIndex()); #if defined(Q_WS_MAEMO_5) DocumentPropertiesWidget *widget = new DocumentPropertiesWidget(fileInfo, gallery, this); widget->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred); QScrollArea *window = new QScrollArea(this); window->setWindowFlags(window->windowFlags() | Qt::Window); window->setAttribute(Qt::WA_DeleteOnClose); window->setAttribute(Qt::WA_Maemo5StackedWindow); window->setWidgetResizable(true); window->setWidget(widget); window->show(); #elif defined (Q_OS_SYMBIAN) QScrollArea *window = new QScrollArea(this); DocumentPropertiesWidget *widget = new DocumentPropertiesWidget(fileInfo, gallery, window); widget->setWindowModality(Qt::WindowModal); window->setWindowFlags(window->windowFlags() | Qt::Dialog); window->setAttribute(Qt::WA_DeleteOnClose); window->setWidgetResizable(true); window->setWidget(widget); window->showMaximized(); #else DocumentPropertiesWidget *widget = new DocumentPropertiesWidget(fileInfo, gallery, this); widget->setWindowFlags(widget->windowFlags() | Qt::Dialog); widget->setAttribute(Qt::WA_DeleteOnClose); widget->setWindowModality(Qt::WindowModal); # if defined(Q_OS_SYMBIAN) widget->showMaximized(); # else widget->show(); # endif #endif } }
void CGraphicBuildingTile::display(QList<QString> _toDisplay) { QDialog* infoDialog = new QDialog;//(dynamic_cast<QWidget*>(this->parent())); QVBoxLayout* newLayout = new QVBoxLayout(); int q=0; QScrollArea* scrolArea = new QScrollArea(dynamic_cast<QWidget*>(this->parent())); for(int i=0;i<_toDisplay.count();i++) { QLabel* newLabel = new QLabel(_toDisplay.at(i)); newLabel->setFixedWidth(280); newLabel->setMinimumHeight(22); newLabel->setStyleSheet("border: 1px solid black"); newLayout->addWidget(newLabel); q++; } QPalette pal; pal.setColor(QPalette::Background,QColor(230,200,167)); infoDialog->setFixedWidth(330); infoDialog->setMinimumHeight(30+22*q); infoDialog->setLayout(newLayout); infoDialog->setAutoFillBackground(true); infoDialog->setPalette(pal); infoDialog->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::Dialog); scrolArea->setWidget(infoDialog); scrolArea->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::Dialog); scrolArea->setMaximumHeight(infoDialog->size().height()+2); scrolArea->setWindowTitle(QString("Info about")); scrolArea->show(); }