Giter Club home page Giter Club logo

qpathedit's Introduction

QPathEdit

A Qt-Widget to get local file and folder-paths in an optimized and simple way.

Introduction

The QPathEdit class was designed to provide a widget that allows the user to easily enter or select a local file or directory path. The widget comes with a plugin for QtCreator.

Details

The QPathEdit Class

The QPathEdit class provides the following features:

  • Appereance: The Edit is composed of a QLineEdit and QToolButton. It uses natives styles. It should look "normal" on any plattform. It provides 3 different styles to allows customisation of the way these components are displayed.
  • Dialog: The user will be able to select his path using QFileDialog. The dialog can be customized to a limited amount.
  • Validation: The edit automatically validates entered and selected paths and makes shure, that it always returns a valid path to your program.
  • Editable: The edit can be editable or readonly. If editable, the validator will mark invalid paths and an auto completer will simplify path entering.
  • Completer: The edit uses an auto completer, that uses the underlying file-system to provide paths as autocompletion to make entering paths even easiert. It can be turned on and off.
  • QtCreator Plugin: The edit widget comes with an designer-plugin for Qt-Creator, to make it possible to user the pathEdit insider .ui files.

Installation

The package is providet as qpm package, de.skycoder42.qpathedit. To install:

  1. Install qpm (See GitHub - Installing, for windows see below)
  2. In your projects root directory, run qpm install de.skycoder42.qpathedit
  3. Include qpm to your project by adding include(vendor/vendor.pri) to your .pro file

Check their GitHub - Usage for App Developers to learn more about qpm.

Important for Windows users: QPM Version 0.10.0 (the one you can download on the website) is currently broken on windows! It's already fixed in master, but not released yet. Until a newer versions gets released, you can download the latest dev build from here:

Usage - A simple Example

Since the QPathEdit is just a simple widget, you can use it like any other widget. The following example will create a simple window with the QPathEdit inside. If the user enters a path, the new path will be logged on the console:

#include <QApplication>
#include <QWidget>
#include <QVBoxLayout>
#include <QPathEdit>

int main(int argc, char *argv[])
{
   QApplication a(argc, argv);
   
   QWidget window;
   QVBoxLayout *layout = new QVBoxLayout(&window);
   QPathEdit *edit = new QPathEdit(&window);
   layout->addWidget(edit);
   window.setLayout(layout);
   
   QObject::connect(edit, &QPathEdit::pathChanged, [](QString path){
       qDebug() << path;
   });
   
   window.show();
   return a.exec();
}

Installing the Plugin

To install the plugin, you need to copy the right file from the designerplugins.zip zip-package to the QtCreators designer plugin path. There are a number of subfolders for operating systems I've created the plugin for. If yours is not present, you need to compile the plugin yourself. Copy file (for example qpatheditplugin.dll) into QtCreators path. The default path would be:

  • Windows: <path_to_qt>/Tools/QtCreator/bin/plugins/designer
  • OsX: <qt_creator_bundle>/Contents/PlugIns/designer
  • Linux: <path_to_qt>/Tools/QtCreator/lib/Qt/plugins/designer

After restarting the creator, navigate to the designer and to "Tools > Form Editor > About Qt Designer Plugins". The plugin should appear there. In the editor itself, you can find it inside the "Input Widgets" Section.

For more details, check Adding Qt Designer Plugins.

Documentation

The documentation is available within the releases and on github pages.

The documentation was created using doxygen. It includes an HTML-documentation and Qt-Help files that can be included into QtCreator (QtAssistant) to show F1-Help (See Adding External Documentation for more details).

Icons

The edit uses a default icon for joined dialog buttons. The icon was downloaded from http://www.fatcow.com/free-icons.

qpathedit's People

Contributors

skycoder42 avatar mikeeeeeeeeeeeeeeee avatar martonmiklos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.