Search Results

Search found 15 results on 1 pages for 'qfiledialog'.

Page 1/1 | 1 

  • QT QFileDialog how to hide hidden/backup folders (".folder")

    - by Alberto Toglia
    Basically when browsing folders inside a QFileDialog I find very annoying to have everything bloated with hidden or backup folders (don't know how to call them really); specially on home. Is there a way to prevent these type of folders from showing by default on a QFileDialog? I'm using Qt4.6 and getOpenFileName. P.D.: I'm starting to think this might be an ubuntu thing...?

    Read the article

  • QFileDialog filter from mime-types

    - by Mathias
    I want the filter in a QFileDialog to match all audio file types supported by Phonon on the platform in question. 1 - However I am not able to find a way in Qt to use mime types in a filter. How can I do that? 2 - Or how can I find the corresponding file extensions for the mimetypes manually? The solution should be Qt based, or at least be cross platform and supported everywhere Qt is. Following is a short code describing my problem: #include <QApplication> #include <QFileDialog> #include <QStringList> #include <phonon/backendcapabilities.h> QString mime_to_ext(QString mime) { // WHAT TO REALLY DO ?? // NEEDLESS TO SAY; THIS IS WRONG... return mime.split("/").back().split('-').back(); } int main(int argc, char **argv) { QApplication app(argc, argv); QStringList p_audio_exts; QStringList p_mime_types = Phonon::BackendCapabilities::availableMimeTypes(); for(QStringList::iterator i = p_mime_types.begin(), ie = p_mime_types.end(); i != ie; i++) { if((*i).startsWith("audio")) p_audio_exts << mime_to_ext(*i); } QString filter = QString("All Files(*)"); if(!p_audio_exts.isEmpty()) { QString p_audio_filter = QString("Audio Files (*.%1)").arg(p_audio_exts.join(" *.")); filter = QString("%1;;%2").arg(p_audio_filter).arg(filter); } QFileDialog dialog(NULL, "Open Audio File", QString::null, filter); dialog.exec(); }

    Read the article

  • how to set filter for directories qt qfiledialog

    - by sneha
    hello everyone,i would like to know is there any way to select only some directories and some files at a time using qfiledialog class.here i set filesfilter..but i also need to set folder filter i mean i want only certain/some folders to be selected of name (i mean i need a filter for folders too.. coz i hav a common format for my application folders like example : name.abc,flight.abc etc all these are my folder names..i want to enable selection only for these type of folders which are named at last as .abc) i am using QStringList files = QFileDialog::getOpenFileNames(this, tr("Files & Directories"), QDir::currentPath(),tr(".doc.txt") ); tr(".doc.txt") is my files filter,same way i need folders filter with name only .abc at the end

    Read the article

  • QFileDialog used as widget

    - by lvp
    Hi! My goal is: user can choose file (only *mp3) and after clicking twice on it it should play (so the QString to file should be send to play() funtion) Firstly I started to work with QTreeView, but it has signal when the file is selected. So I decided to create QFileDialog and used it as widget built-in into MainWindow. The only problem that I have, that after double-click it dissapers. It is possible to avoid it? Should I work with some QDialog::finished() signal or, QDialog::done()?

    Read the article

  • Qt QFileDialog - native dialogs only with static functions?

    - by darron
    I'm trying to simply save a file. However, I need a filename entered without a suffix to automatically get a default suffix (which setDefaultSuffix() does). I'd rather not completely lose the native save dialog just for this. exec() is not overloaded from QDialog, so it totally bypasses the native hook (ignoring the DontUseNativeDialog option even if it's false). If I disable the file overwrite warning and append the default suffix myself after the function returns, then I'd be re-opening the dialog if the user did not want to overwrite... and that's just ugly. Is there some signal I can catch and quickly inject the default suffix if it's not there? I'm guessing not, since it's a native dialog. Is there something I'm doing wrong with the filter? I only have one filter choice. It should use that extension. This seems pretty lame. Launching the save dialog and simply typing "test" should never result in an extensionless file. "test.", yes. "test" no way. That'll really confuse the users when they hit Load and can't see the file they just saved. I guess the cross-platform part of Qt is giving me lowest common denominator file dialog functionality?

    Read the article

  • [PyQt4] QFileDialog problem (native: fast but no input field; non-native: has input field but slow)

    - by Bing Jian
    Hi, This seems a known problem but I have not found a good workaround. I like the style of the non-native QFileDialog, especially the feature that allows the user to input the path directly which is very convenient since the user can easily copy/paste the folder/file name from other applications. However, it seems very slow when the dialog is first launched. The native option is quite responsive but the problem is that it does not provide an input field so for the user to select a folder he/she has to walk into the directory, which can take many mouse clicks and is not fun. I am not sure if you have experienced similar problem or if I miss something. BTW, my PyQt version is 4.4.3 and I am working on Windows XP. Thanks, Bing

    Read the article

  • QFileDialog and german umlaute within a path

    - by MB
    Hey Everybody, i am working on a project, which i am developing with Python and PyQT4. I have stumbled upon a somewhat odd behaviour of the QFileDialog, that is not occuring when running the project within in my IDE (Eclipse). The problem is that QFileDialog in ExistingFiles-mode does fail to return the list of selected files, when one of the file paths is containing a german umlaut (ä,ü,ö, etc.) The QFileDialog is not offering options or parameters to make it sensible regarding this scenario. Does anyone have any ideas of how to tackle this issue?

    Read the article

  • How to open file and Directory in QT

    - by sijith
    Hi, I want to open Directory and file using the same function. Is it possible to do the same in QT. I used QString directory = QFileDialog::getExistingDirectory(this, tr("Open Directory"), "", QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); Here i can open only directory. How to open both file and directory using single function

    Read the article

  • Making File Dialog only accept directories

    - by matt
    I want to have a file dialog only allow directories, here's what I've been trying: fileDialog = QtGui.QFileDialog() fileDialog.setFileMode(QtGui.QFileDialog.ShowDirsOnly) filename = fileDialog.getOpenFileName(self, 'Select USB Drive Location')) Thank You

    Read the article

  • Un navigateur de fichiers basé sur une QListBox, un article des Qt Quarterly traduit par charlespf

    Cet article présente FileBrowser, une sous-classe de QListBox grâce à laquelle l'utilisateur navigue dans ses répertoires et fichiers. Par rapport à QFileDialog, qui s'ouvre dans une fenêtre modale, le widget FileBrowser peut s'embarquer dans la fenêtre principale ou dans une boîte de dialogue d'une application, ce qui peut donner un avantage pour la navigation. Un navigateur de fichiers basé sur une QListBox...

    Read the article

  • Which Qt classes use the disk directly?

    - by Jurily
    I'm trying to write a library to separate all the disk activity out into its own thread, but the documentation doesn't really care about such things. What I want to accomplish is that aside from startup, all disk activity is asynchronous, and for that, I need to wrap every class that accesses the disk. Here's what I found so far: QtCore: QFile QTemporaryFile QDir QFileInfo QFileSystemWatcher QDirIterator QSettings QtGui: QFileDialog QFileSystemModel QDirModel (unsure) QFont (unsure) QFontDialog I'm sure there are more.

    Read the article

  • Issue Parsing File with YAML-CPP

    - by Andrew
    In the following code, I'm having some sort of issue getting my .yaml file parsed using parser.GetNextDocument(doc);. After much gross debugging, I've found that the (main) issue here is that my for loop is not running, due to doc.size() == 0; What am I doing wrong? void BookView::load() { aBook.clear(); QString fileName = QFileDialog::getOpenFileName(this, tr("Load Address Book"), "", tr("Address Book (*.yaml);;All Files (*)")); if(fileName.isEmpty()) { return; } else { try { std::ifstream fin(fileName.toStdString().c_str()); YAML::Parser parser(fin); YAML::Node doc; std::map< std::string, std::string > entry; parser.GetNextDocument(doc); std::cout << doc.size(); for( YAML::Iterator it = doc.begin(); it != doc.end(); it++ ) { *it >> entry; aBook.push_back(entry); } } catch(YAML::ParserException &e) { std::cout << "YAML Exception caught: " << e.what() << std::endl; } } updateLayout( Navigating ); } The .yaml file being read was generated using yaml-cpp, so I assume it is correctly formed YAML, but just in case, here's the file anyways. ^@^@^@\230--- - address: ****************** comment: None. email: andrew(dot)levenson(at)gmail(dot)com name: Andrew Levenson phone: **********^@ Edit: By request, the emitting code: void BookView::save() { QString fileName = QFileDialog::getSaveFileName(this, tr("Save Address Book"), "", tr("Address Book (*.yaml);;All Files (*)")); if (fileName.isEmpty()) { return; } else { QFile file(fileName); if(!file.open(QIODevice::WriteOnly)) { QMessageBox::information(this, tr("Unable to open file"), file.errorString()); return; } std::vector< std::map< std::string, std::string > >::iterator itr; std::map< std::string, std::string >::iterator mItr; YAML::Emitter yaml; yaml << YAML::BeginSeq; for( itr = aBook.begin(); itr < aBook.end(); itr++ ) { yaml << YAML::BeginMap; for( mItr = (*itr).begin(); mItr != (*itr).end(); mItr++ ) { yaml << YAML::Key << (*mItr).first << YAML::Value << (*mItr).second; } yaml << YAML::EndMap; } yaml << YAML::EndSeq; QDataStream out(&file); out.setVersion(QDataStream::Qt_4_5); out << yaml.c_str(); } }

    Read the article

  • C++ GUI using QT

    - by user1488019
    I want to build a c++ GUI using Qt plaform. this a part of my code which is about opening an image file. i used this method to open the image, but when i choose it from a specific folder nothing is shown (no image). void MainWindow::openI() { QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), QDir::currentPath()); if (!fileName.isEmpty()) { QImage image(fileName); if (image.isNull()) { QMessageBox::information(this, tr("Image Viewer"), tr("Cannot load %1.").arg(fileName)); return; } } } Please help me!! this is a small part of my project

    Read the article

  • how to run this qt script? (newbie question)

    - by GB_J
    I have a qt script(barchart.qs) that creates a graph for me. I don't know how i can incorporate(ie show the graph) in my qt mainwindow. Can some one please help me look at the code and what its outputs are? I tried engine.evaluate, but i do not know what is the QScriptValue i'm getting in return. Thanks sooo much. This is the script: BarChart.prototype = new QWidget; BarChart.prototype.suffix = ""; function BarChart(parent) { QWidget.call(this, parent); } // find the maximum value and widest (pixel-wise) label and suffix BarChart.prototype.showEvent = function(event) { var fm = new QFontMetrics(this); this.margin = 20; this.titleHeight = fm.height(); this.barHeight = 1.5 * fm.height(); this.barSpacing = 0.6 * fm.height(); this.maxValue = this.suffixWidth = this.labelWidth = 0; var count = 0; for (d in this.data) { this.labelWidth = Math.max(this.labelWidth, fm.width(d)); this.maxValue = Math.max(this.maxValue, this.data[d]); this.suffixWidth = Math.max(this.suffixWidth, fm.width(String(this.data[d]) + " " + this.suffix)); count++; } this.startHue = 15; this.hueDelta = 360 / count; this.size = new QSize(640, this.titleHeight + 2 * this.margin + (this.barHeight + this.barSpacing) * count); } BarChart.prototype.paintEvent = function(event) { var p = new QPainter; p.begin(this); // background and title p.fillRect(this.rect, new QBrush(new QColor(255, 255, 255))); p.drawText(0, 0, this.width, this.margin + this.titleHeight, Qt.AlignCenter, this.windowTitle, 0); var ofs = this.labelWidth + this.margin; var ww = this.width - this.suffixWidth - ofs - 2 * this.margin; var hue = this.startHue; var y = 0; p.translate(this.margin, this.titleHeight + 1.5 * this.margin); for (d in this.data) { // label on the left side p.setPen(new QColor(Qt.black)); p.drawText(0, y, this.labelWidth, this.barHeight, Qt.AlignVCenter + Qt.AlignRight, d, 0); // the colored bar var gradient = new QLinearGradient(new QPoint(ofs, y), new QPoint(ofs, y + this.barHeight)); gradient.setColorAt(0, QColor.fromHsv(hue, 255, 240)); gradient.setColorAt(1, QColor.fromHsv(hue, 255, 92)); p.setBrush(new QBrush(gradient)); p.setPen(new QColor(96, 96, 96)); var bw = this.data[d] * ww / this.maxValue; p.drawRect(ofs, y, bw, this.barHeight); // extra text at the end of the bar var text = new String(this.data[d] + " " + this.suffix); p.setPen(new QColor(Qt.black)); p.drawText(ofs + bw + this.margin/2, y, this.suffixWidth, this.barHeight, Qt.AlignVCenter + Qt.AlignLeft, text, 0); // for the next bar y += (this.barHeight + this.barSpacing); hue += this.hueDelta; if (hue >= 360) hue -= 360; } p.end(); } BarChart.prototype.wheelEvent = function(event) { this.startHue += event.delta() / 8 / 5; if (this.startHue = 360) this.startHue -= 360; if (this.startHue < 0) this.startHue += 360; this.update(); event.ignore(); } BarChart.prototype.mousePressEvent = function(event) { var fname = QFileDialog.getSaveFileName(this, "Save", ".", "*.png", 0, 0); if (fname.length > 0) { var img = new QImage(this.size, QImage.Format_ARGB32_Premultiplied); this.render(img); img.save(new QFile(fname)); } } var chart = new BarChart; chart.windowTitle = "Monthly"; chart.suffix = "reports"; chart.data = { "September" : 45, "October" : 60, "November" : 56, "December" : 0 }; chart.show(); QCoreApplication.exec();

    Read the article

1