qt

Description: Разработка и отладка приложений. Упор на 3D-графику.

dyvniy M
Topic author, Администратор
Администратор
Avatar
dyvniy M
Topic author, Администратор
Администратор
Age: 36
Reputation: 1
Loyalty: 1
Posts: 3159
Joined: Wed, 10 Oct 2012
With us: 6 years 9 months
Профессия: Программист
Location: Россия, Москва
ICQ Website Skype VK

#1by dyvniy » Thu, 3 Apr 2014, 08:11:41

Движок!
https://github.com/DistinctVision/QScrollEngine
http://www.gamedev.ru/code/forum/?id=217870

Лицензия.
Надо её понять.
http://doc.qt.io/qt-5/lgpl.html

Добавление своего типа в QVariant
http://qtcoder.blogspot.ru/2011/06/qvariant.html

Code: Select all


class SomeClass
 
{
//всё что нужно
 };
 Q_DECLARE_METATYPE(SomeClass)

Итак, достаточно после определения класса вызвать макрос Q_DECLARE_METATYPE()
Что это дает?
Помещаем экземпляр класса в QVariant.

Code: Select all


SomeClass scl
;
 QVariant vclass = QVariant::fromValue(scl);

Всё, теперь экземпляр класса SomeClass, хранится как QVariant и с ним можно делать всё, что и с объектами типа QVariant.
Обратное преобразование.

Code: Select all


scl 
= qvariant_cast(vclass);


Передача объектов пользовательских классов через QVariant / Qt
http://www.cyberforum.ru/qt/thread544896.html

Code: Select all

qVariantFromValue(УказательНаОбъект);


Хитрый патч

Code: Select all

#define Q_DECLARE_METATYPE_COMMA(...) \
QT_BEGIN_NAMESPACE \
template <> \
struct QMetaTypeId< __VA_ARGS__ > \
{
 \
     enum { Defined = 1 }; \
  static int qt_metatype_id() \
  { \
     static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \
     if (!metatype_id) \
        metatype_id = qRegisterMetaType< __VA_ARGS__ >( #__VA_ARGS__, \
          reinterpret_cast< __VA_ARGS__ *>(quintptr(0))); \
     return metatype_id; \
  } \
};
 \
QT_END_NAMESPACE \
 


Added after 7 hours 5 minutes:
Синхронная и асинхронная загрузка файлов из инета.
http://www.pvsm.ru/qt-2/2875
Image

dyvniy M
Topic author, Администратор
Администратор
Avatar
dyvniy M
Topic author, Администратор
Администратор
Age: 36
Reputation: 1
Loyalty: 1
Posts: 3159
Joined: Wed, 10 Oct 2012
With us: 6 years 9 months
Профессия: Программист
Location: Россия, Москва
ICQ Website Skype VK

#2by dyvniy » Thu, 10 Apr 2014, 16:00:29

Публикация на андроид маркете (android market)
http://doc.qt.io/qt-5/publishtogoogleplay.html
Spoiler
Publishing to Google Play

Qt for Android provides a complete solution to develop, build, and package your applications for Android. Most of these tasks, especially packaging and deployment are handled by Qt Creator providing rich developer experience.

Every time you run the application using Qt Creator, an Android Application Package (APK) is created and deployed onto the target (device or emulator) you choose. With some minor changes to how the .apk is created, you can publish your application on Google Play and monetize. The following step-by-step instructions guide you to create an .apk that can go live on Google Play:

Open your application project using Qt Creator v3.0 or later and change its Build settings to build release version.
Select Create Templates under Build settings to create the template files such as AndroidManifest.xml and other resources.
Note: You can edit the AndroidManifest.xml in General or XML Source mode.

Check for the following in AndroidManifest.xml:
Minimum required SDK is set to API 9 or later.
Note: Qt Quick Controls with native Android style require API 11 (Android v3.0) or later.

Add Application name and Application icon.
Permissions list has all the required permissions.
Features list has the software or hardware features that your application depends on. For example, NFC.
Note: Qt adds the default permissions and features based on the module dependencies of your application. If you do not want these default permissions and features, remove the <!-- %%INSERT_PERMISSIONS --> and <!-- %%INSERT_FEATURES --> comments from AndroidManifest.xml. For information on the manifest XML format, see Android: App Manifest.

Set up a keystore to sign the .apk. You can create a new keystore if you do not have one. For more details, see QtCreator: Specifying Settings for Packages.
Select Open package location after build and run your application to build the .apk. Qt Creator builds the .apk and opens the folder containing the .apk.
Log in to the Google Play Developer Console and upload the .apk file, few screen captures of the application, and a description.
Now your application is available to other Android device users via Google Play. You can also choose to publish the application to a smaller group, so that you can test and improve the application before publishing it to a larger audience.

See Deploying an Application on Android for more information about how the packaging is done and how you can influence it.

Создаём щаблоны проектов!!! (wisards)
https://toster.ru/q/221493
http://doc.qt.io/qtcreator/creator-project-wizards-xml.html
http://doc.qt.io/qtcreator/creator-project-wizards-json.html
Spoiler
Adding JSON-Based Wizards

Qt Creator searches for wizards in the shared directory and in the local user's settings directory, as described in Locating Wizards.

JSON-based wizard template directories contain a JSON configuration file called wizard.json and any template files needed. The configuration file contains sections that specify information about the wizard, variables that you can use, wizard pages, and generators for creating files.

To create a customized wizard, copy a template directory to the shared directory or the settings directory under a new name. If you want to use qmake to build the wizard and integrate it into Qt Creator, use the shared directory. Otherwise, you can create a subdirectory in the settings directory. The standard wizards are organized into subdirectories by type, but you can add your wizard directory to any directory you like. The folder hierarchy does not affect the order in which the wizards are displayed.

To share the wizard with other users, you can create an archive of the wizard directory and instruct the recipients to extract it into one of the directories Qt Creator searches wizards from.

For wizard development, we recommend that you start Qt Creator with the -customwizard-verbose argument to receive confirmation that Qt Creator was able to find and parse the wizard.json file. The verbose mode displays information about syntax errors, which are the most typical errors you might run into while editing wizards. For more information, see Verbose Output.

In addition, set keyboard shortcuts for the Inspect and Factory.Reset functions to be able to inspect the fields and variables in the wizard and to have the wizard listed in File > New File or Project without restarting Qt Creator. For more information, see Tips for Wizard Development.

Qt Creator displays the wizards that it finds in the New File or Project dialog. For each wizard, an icon (1), a display name (2), and a description (3) are displayed.



Integrating Wizards into Qt Creator Builds

To integrate the wizard into Qt Creator and to deliver it as part of the Qt Creator build, place the wizard files in the Qt Creator sources. Then select Build > Run qmake, so that the new files you added for your wizard are actually copied from the Qt Creator source directory into the Qt Creator build directory as part of the next Qt Creator build.

If you do not run qmake, your new wizard will not show up, because it does not exist in the build directory you run your newly built Qt Creator from. It never got copied there, because make did not know that the files exist in the source tree, because qmake did not inform make that the files were added recently.

Basically, qmake generates a fixed list of files to copy from the source directory to the sudirectory of the build directory that is checked for wizards at runtime. Therefore, you need to run qmake or execute the Factory.Reset function each time the names or locations of the files change.

Using Variables in Wizards

You can use variables (%\{<variableName>\}) in the configuration and template source files. A set of variables is predefined by the wizards and their pages. You can introduce new variables as shortcuts to be used later. Define the variable key names and values in the options section in the wizard.json file.

The variables always return strings. In places where a boolean value is expected and a string is given, an empty string as well as the string "false" is treated as false and anything else as true.

Localizing Wizards

If a setting name starts with the tr prefix, the value is visible to users and should be translated. If the new wizard is included in the Qt Creator sources, the translatable strings appear in the Qt Creator translation files and can be translated as a part of Qt Creator. Alternatively, you can place the translations in the .json file using the following syntax:

"trDisplayName": { "C": "default", "en_US": "english", "de_DE": "deutsch" }
For example:

"trDisplayName": { "C": "Project Location", "en_US": "Project Location", "de_DE": "Projekt Verzeichnis" }
Creating Wizards

Qt Creator contains wizards for adding classes, files, and projects. You can use them as basis for adding your own wizards. We use the C++ wizard to explain the process and the sections and settings in the .json file.

In this example, we create the wizard directory in the shared directory and integrate it in the Qt Creator build system, so that it can deployed along with the Qt Creator binaries as part of the build.



For more information about the pages and widgets that you can add and their supported properties, see Available Pages and Available Widgets.

To create a JSON-based C++ class wizard:

Start Qt Creator with the -customwizard-verbose argument to receive feedback during wizard development. For more information, see Verbose Output.
Set keyboard shortcuts for the Inspect and Factory.Reset actions, as described in Tips for Wizard Development.
Make a copy of share/qtcreator/templates/wizards/classes/cpp and rename it. For example, share/qtcreator/templates/wizards/classes/mycpp
Use the Factory.Reset action to make the wizard appear in File > New File or Project without restarting Qt Creator.
Open the wizard configuration file, wizard.json for editing:
The following settings determine the type of the wizard and its place in the New File or Project dialog:
"version": 1,
"supportedProjectTypes": [ ],
"id": "A.Class",
"category": "O.C++",
version is the version of the file contents. Do not modify this value.
supportedProjectTypes is an optional setting that can be used to filter wizards when adding a new build target to an existing project. For example, only wizards that produce qmake projects should be provided when adding a new target to an existing qmake project.
Possible values are the build systems supported by Qt Creator or UNKNOWN_PROJECT if the build system is not specified: AutotoolsProjectManager.AutotoolsProject, CMakeProjectManager.CMakeProject, GenericProjectManager.GenericProject, PythonProject, Qbs.QbsProject, Qt4ProjectManager.Qt4Project (qmake project), QmlProjectManager.QmlProject

id is the unique identifier for your wizard. Wizards are sorted by the ID in alphabetic order within the category. You can use a leading letter to specify the position of the wizard. You must always change this value. For example, B.MyClass.
This information is available in the wizard as %\{id\}.

category is the category in which to place the wizard in the list. You can use a leading letter to specify the position of the category in the list in the New File or Project dialog.
This information is available in the wizard as %\{category\}.

The following settings specify the icon and text that appear in the New File or Project dialog:
"trDescription": "Creates a C++ header and a source file for a new class that you can add to a C++ project.",
"trDisplayName": "C++ Class",
"trDisplayCategory": "C++",
"icon": "../../global/genericfilewizard.png",
"enabled": "%{JS: [ %{Plugins} ].indexOf('CppEditor') >= 0}",
trDescription appears in the right-most panel when trDisplayCategory is selected.
This information is available in the wizard as %\{trDescription\}.

trDisplayName appears in the middle panel when trDisplayCategory is selected.
This information is available in the wizard as %\{trDisplayName\}.

trDisplayCategory appears in the New File or Project dialog, under Projects.
This information is available in the wizard as %\{trDisplayCategory\}.

icon appears next to the trDisplayName in the middle panel when trDisplayCategory is selected. We recommend that you specify the path relative to the wizard.json file, but you can also use an absolute path.
image specifies a path to an image (for example a screenshot) that appears below the trDescription.
featuresRequired specifies the Qt Creator features that the wizard depends on. If a required feature is missing, the wizard is hidden. For example, if no kit has a Qt version set, then the qmake-based wizards are hidden.
Use enabled if you need to express more complex logic to decide whether or not your wizard will be available.

This information is available in the wizard as %\{RequiredFeatures\}.

featuresPreferred specifies the build and run kits to preselect.
This information is available in the wizard as %\{PreferredFeatures\}.

platformIndependent is set to true if the wizard is supported by all target platforms. By default, it is set to false.
enabled is evaluated to determine whether a wizard is listed in Files > New File or Project, after featuresRequired has been checked.
The default value is true.

The options section contains an array of objects with key and value attributes. You can define your own variables to use in the configuration and template source files, in addition to the predefined variables. For example, the following variables are used in the C++ class creation wizard:
"options":
[
{ "key": "TargetPath", "value": "%{Path}" },
{ "key": "HdrPath", "value": "%{Path}/%{HdrFileName}" },
{ "key": "SrcPath", "value": "%{Path}/%{SrcFileName}" },
{ "key": "CN", "value": "%{JS: Cpp.className('%{Class}')}" },
{ "key": "Base", "value": "%{JS: ( '%{BaseCB}' === '' ) ? '%{BaseEdit}' : '%{BaseCB}'}" },
{ "key": "isQObject", "value": "%{JS: ('%{Base}' === 'QObject' || '%{Base}' === 'QWidget' || '%{Base}' === 'QMainWindow' || '%{Base}' === 'QDeclarativeItem' || '%{Base}' === 'QQuickItem' ) ? 'yes' : ''}" },
{ "key": "GUARD", "value": "%{JS: Cpp.classToHeaderGuard('%{Class}', '%{JS: Util.preferredSuffix('text/x-c++hdr')}')}" },
{ "key": "SharedDataInit", "value": "%{JS: ('%{IncludeQSharedData}') ? 'data(new %{CN}Data)' : '' }" }
],
This section is optional. For more examples of variables, see the wizard.json files for other wizards.

The pages section specifies the wizard pages. The pages used depend on the wizard type. You can add standard pages to wizards or create new pages using the available widgets. The following settings specify the display name, title, and type of the page:
"pages":
[
{
"trDisplayName": "Define Class",
"trShortTitle": "Details",
"typeId": "Fields",
"data" :
[
{
"name": "Class",
"trDisplayName": "Class name:",
"mandatory": true,
"type": "LineEdit",
"data": { "validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)+[a-zA-Z_][a-zA-Z_0-9]*|)" }
},
...
]
typeId specifies the page to use: Fields, File, Form, Kits, Project, VcsConfiguration, VcsCommand or Summary.
Full page ID, as used in the code, consists of the typeId prefixed with "PE.Wizard.Page.". For more information, about the pages, see Available Pages.

trDisplayName specifies the title of the page. By default, the page title is used.
trShortTitle specifies the title used in the sidebar of the Wizard. By default, the page title is used.
trSubTitle specifies the subtitle of the page. By default, the page title is used.
index is an integer value that specifies the page ID. It is automatically assigned if you do not set it.
enabled is set to true to show the page and to false to hide it.
data specifies the wizard pages. In the C++ wizard, it specifies a Fields page and a Summary page. The Fields page contains the CheckBox, ComboBox, LineEdit, PathChooser, and Spacer widgets. For more information about the widgets, see Available Widgets.
The generators section specifies the files to be added to the project:
"generators":
[
{
"typeId": "File",
"data":
[
{
"source": "file.h",
"target": "%{HdrPath}",
"openInEditor": true
},
{
"source": "file.cpp",
"target": "%{SrcPath}",
"openInEditor": true
}
]
typeId specifies the type of the generator. Currently, only File or Scanner is supported.
data allows to configure the generator further.
Values Available to the Wizard

In addition to properties taken from the wizard.json file itself (see Creating Wizards), Qt Creator makes some information available to all JSON based wizards:

WizardDir is the absolute path to the wizard.json file.
Features lists all features available via any of the kits configured in Qt Creator.
Plugins contains a list of all plugins running in the current instance of Qt Creator.
Platform contains the platform selected in the File > New File or Project dialog. This value may be empty.
The following information is only available when the wizard was triggered via the context menu of a node in the Projects view:

InitialPath with the path to the selected node.
ProjectExplorer.Profile.Ids contains a list of Kits configured for the project of the selected node.
Available Pages

You can add predefined pages to wizards by specifying them in the pages section of a wizard.json file.

Field Page

A Field page has the typeId value Field and contains widgets. For more information about widget definitions, see Available Widgets.

"pages":
[
{
"trDisplayName": "Define Class",
"trShortTitle": "Details",
"typeId": "Fields",
"data" :
[
{
"name": "Class",
"trDisplayName": "Class name:",
"mandatory": true,
"type": "LineEdit",
"data": { "validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)+[a-zA-Z_][a-zA-Z_0-9]*|)" }
},
...
],
File Page

A File page has the typeId value File. You can leave out the data key or assign an empty object to it.

{
"trDisplayName": "Location",
"trShortTitle": "Location",
"typeId": "File"
},
The page evaluates InitialFileName and InitialPath from the wizard to set the initial path and filename. The page sets TargetPath to the full path of the file to be created.

Form Page

A Form page has the typeId value Form. You can leave out the data key or assign an empty object to it.

{
"trDisplayName": "Choose a Form Template",
"trShortTitle": "Form Template",
"typeId": "Form"
},
The page sets FormContents to an array of strings with the form contents.

Kits

A Kits page has the typeId value Kits. The data section of a Kits page contains an object with the following settings:

projectFilePath with the path to the project file.
requiredFeatures with a list of strings or objects that describe the features that a kit must provide to be listed on the page.
When a string is found, this feature must be set. When using an object instead, the following settings are checked:

feature, which must be a string (that will have all %\{<VariableName\} expanded).
condition, which must evaluate to true or false and can be used to discount the feature from the list.
preferredFeatures with a list in the same format as requiredFeatures. Any kit matching all features listed in preferredFeatures (in addition to requiredFeatures) will be pre-selected on this page.
{
"trDisplayName": "Kit Selection",
"trShortTitle": "Kits",
"typeId": "Kits",
"enabled": "%{IsTopLevelProject}",
"data": { "projectFilePath": "%{ProFileName}" }
},
The page evaluates %\{Platform\} to set the platform selected in File > New File or Project.

Project

A Project page has the typeId value Project. It contains no data or an object with the trDescription property which will be shown on the generated page. trDescription defaults to %\{trDescription\}, which is filled in with the information taken from the trDescription field of the wizard.json file.

{
"trDisplayName": "Project Location",
"trShortTitle": "Location",
"typeId": "Project",
"data": { "trDescription": "A description of the wizard" }
},
The page evaluates InitialPath to set the initial project path. The page sets ProjectDirectory and TargetPath to the project directory.

Summary

A Summary page has the typeId value Summary. It contains no data or an empty object.

{
"trDisplayName": "Project Management",
"trShortTitle": "Summary",
"typeId": "Summary"
}
The page sets IsSubproject to an empty string if this is a toplevel project and to yes otherwise. It sets VersionControl to the ID of the version control system in use.

VcsCommand

The VcsCommand page runs a set of version control operations and displays the results.

The data section of this page takes an object with the following keys:

vcsId with the id of the version control system to be used.
trRunMessage with the message to be shown while the version control is running.
extraArguments with a string or a list of strings defining extra arguments passed to the version control checkout command.
repository with the URL to check out from the version control system.
baseDirectory with the directory to run the checkout operation in.
checkoutName with the subdirectory that will be created to hold the checked out data.
extraJobs with a list of objects defining additional commands to run after the initial checkout. This can be used to customize the repository further by for example adding additional remote repositories or setting configuration variables of the version control system.
Each extraJob is defined by an object with the following settings:

skipIfEmpty will cause empty arguments to be silently removed from the command to be run if set to true. Defaults to true.
directory with the working directory of the command to be run. This defaults to the value of baseDirectory.
command with the command to be run.
arguments with the arguments to pass to command.
timeOutFactor can be used to provide for longer than default timeouts for long-running commands.
enabled which will be evaluated to decide whether or not to actually execute this job.
VcsConfiguration

The VcsConfiguration page asks the user to configure a version control system and only enables the Next button once the configuration is successful.

The data section of this page takes an object with the vcsId key. This setting defines the version control system that will be configured.

Available Widgets

You can add the following widgets on a Field page:

Check Box
Combo Box
Label
Line Edit
Path Chooser
Spacer
Text Edit
Note: Only the the settings documented in the following sections are supported in wizards.

Specify the following settings for each widget:

name specifies the widget name. This name is used as the variable name to access the value again.
trDisplayName specifies the label text visible in the UI (if span is not true).
type specifies the type of the widget: CheckBox, ComboBox, Label, LineEdit, PathChooser, Spacer, and TextEdit.
trToolTip specifies a tool tip to show when hovering the field with the mouse.
isComplete is evaluated for all fields to decide whether the Next button of the wizard is available or not. All fields must have their isComplete evaluate to true for this to happen. This setting defaults to true.
trIncompleteMessage is shown when the field's isComplete was evaluated to false.
data specifies settings for the widget:
visible is set to true if the widget is visible, otherwise it is set to false. By default, it is set to true.
enabled is set to true if the widget is enabled, otherwise it is set to false. By default, it is set to true.
mandatory is set to true if this widget must have a value for the Next button to become enabled. By default, it is set to true.
span is set to hide the label and to span the form. By default, it is set to false. For more information, see Using Variables in Wizards.
The additional settings available for a particular widget are described in the following sections.

Check Box

{
"name": "IncludeQObject",
"trDisplayName": "Include QObject",
"type": "CheckBox",
"data":
{
"checkedValue": "QObject",
"uncheckedValue": "",
"checked": "%{JS: ('%{BaseCB}' === 'QObject' ) ? 'yes' : ''}"
}
},
checkedValue specifies the value to set when the check box is enabled. By default, set to 0.
uncheckedValue specifies the value to set when the check box is disabled. By default, set to 1.
checked is set to true if the check box is enabled, otherwise false.
Combo Box

{
"name": "BaseCB",
"trDisplayName": "Base class:",
"type": "ComboBox",
"data":
{
"items": [ { "trKey": "<Custom>", "value": "" },
"QObject", "QWidget", "QMainWindow", "QDeclarativeItem", "QQuickItem" ]
}
},
items specifies a list of items to put into the combo box. The list can contain both JSON objects and plain strings. For JSON objects, define trKey and value pairs, where the trKey is the list item visible to users and value contains the data associated with the item.
index specifies the index to select when the combo box is enabled. By default, it is set to 0.
disabledIndex specifies the index to show if the combo box is disabled.
Label

{
"name": "LabelQQC_1_0",
"type": "Label",
"span": true,
"visible": "%{( '%{CS}' === 'QQC_1_0' ) ? 'yes' : ''}",
"data":
{
"wordWrap": true,
"trText": "Creates a deployable Qt Quick 2 application using Qt Quick Controls. Requires Qt 5.1 or newer."
}
},
wordWrap is set to true to enable word wrap. By default, it is set to false.
trText contains the label text to display.
Line Edit

{
"name": "Class",
"trDisplayName": "Class name:",
"mandatory": true,
"type": "LineEdit",
"data": { "validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)+[a-zA-Z_][a-zA-Z_0-9]*|)" }
},
{
"name": "BaseEdit",
"type": "LineEdit",
"enabled": "%{JS: ( '%{BaseCB}' === '' ) ? 'yes' : ''}",
"mandatory": false,
"data":
{
"trText": "%{BaseCB}",
"trDisabledText": "%{BaseCB}"
}
},
trText specifies the default text to display.
trDisabledText specifies the text to display in a disabled field.
trPlaceholder specifies the placeholder text.
validator specifies a QRegularExpression to validate the line edit against.
fixup specifies a variable that is used to fix up the string. For example, to turn the first character in the line edit to upper case.
Path Chooser

{
"name": "Path",
"type": "PathChooser",
"trDisplayName": "Path:",
"mandatory": true,
"data":
{
"kind": "existingDirectory",
"basePath": "%{InitialPath}",
"path": "%{InitialPath}"
}
},
path specifies the selected path.
basePath specifies a base path that lookups are relative to.
kind defines what to look for: existingDirectory, directory, file, saveFile, existingCommand, command, or any.
Spacer

{
"name": "Sp1",
"type": "Spacer",
"data":
{
"factor": 2
}
},
The factor setting specifies the factor (an integer) to multiply the layout spacing for this spacer.

Text Edit

{
"name": "TextField",
"type": "TextEdit",
"data" :
{
"trText": "This is some text",
"richText": true
}
}
trText specifies the text to display.
trDisabledText specifies the text to display when the text edit is disabled.
richText is set to true for rich text, otherwise false.
Available Generators

Qt Creator supports two different generators for JSON wizards.

File Generator

A File generator expects a list of objects in its data section. Each object defines one file to be processed and copied into the %\{TargetPath\} (or any other location).

Each file object can take the following settings:

source specifies the path and filename of the template file relative to the directory containing the wizard.json file.
If source is unset, it is assumed that the file with the name given in target is generated by some other means. This is useful to for example specify the correct file to open as a project after checking out data from a version control system.

target specifies the location of the generated file, either absolute or relative to %{TargetPath}, which is usually set by one of the wizard pages.
openInEditor opens the file in the appropriate editor if it is set to true. This setting defaults to false.
openAsProject opens the project file in Qt Creator if it is set to true. This setting defaults to false.
isBinary treats the file as a binary and prevents replacements from being done in the file if set to true. This setting defaults to false.
condition generates the file if the condition returns true. This setting defaults to true. For more information, see Using Variables in Wizards.
Scanner Generator

A Scanner generator scans the %\{TargetPath\} and produces a list of all files found there.

The Scanner generator takes one object in its data section with the following settings:

binaryPattern is a regular expression that will be matched against all file names found. Any match will be marked as a binary file and template substitution will be skipped for this file. This setting defaults to an empty pattern, so no files will be marked as binary.
subdirectoryPatterns is a list of regular expression patterns. Any directory matching one of these patterns will be scanned as well as the top level directory. This setting defaults to an empty list and no subdirectories will be scanned.
firstProjectOnly is a boolean value, which will determine whether all project files that were found will be opened as a project or only the first one. This setting defaults to true.

Бегущая строка
http://qt.shamangrad.ru/doku.php?id=бегущая_строка

форум
http://www.forum.crossplatform.ru/

подключение молуля тестов
Открываете .pro файл (это файл проекта на qt используемый как qtcreator, так и собственно qmake) и дописываете в него директиву QT:
QT += testlib gui
таким образом вы подключаете необходимые модули.
иерархия проектов
Qt поддерживает иерархию проектов для этого в корневом .pro-файле следует указать директиву SUBDIRS и перечислить все подпроекты, которые должны принадлежать корневому проекту, естественно в каждом подпроекте должен быть свой .pro-файл. Когда вы дадите команду на сборку корневого проекта все подпроекты будут собраны в указанном порядке.
Image

dyvniy M
Topic author, Администратор
Администратор
Avatar
dyvniy M
Topic author, Администратор
Администратор
Age: 36
Reputation: 1
Loyalty: 1
Posts: 3159
Joined: Wed, 10 Oct 2012
With us: 6 years 9 months
Профессия: Программист
Location: Россия, Москва
ICQ Website Skype VK

#3by dyvniy » Fri, 16 May 2014, 15:39:29

7zip консольное использование
http://habrahabr.ru/post/72636/
7za.exe a -tzip -ssw -mx7 -r0 -x@exclusions.txt full_path_for_the_archive working_dir.
Подробнее

Поподробней об использованных ключах:

-tzip формат архива установлен в zip, без этого ключа умолчальный формат 7z;

-ssw принудительная упаковка файлов, которые в данный момент открыты для записи (мало ли кто-то засиделся на работе и что-то там правит);

-mx7 высокая степень сжатия (7), можно поставить и 5 (нормальное сжатие), тогда процесс пойдет побыстрее;

-r0 (это ноль, а не буква О) исключения, которые будут прописаны дальше обрабатываются только в рабочем каталоге;

-x@exclusions.txt это собственно говоря файл со списком исключений, которые не будем архивировать. Каждая строка файла — новое исключение. Можно использовать маски типа *.ext и т.п. Если исключение не много, то можно обойтись и без файла, в таком случае ключ примет следующий вид: -x!*.ext;

full_path_for_the_archive это соответственно путь и имя нового архива;

working_dir это папка, которая подлежит упаковке.

Для пущего удобства можно использовать в имени архива %date%.

Added after 21 minutes 42 seconds:
7zip в linux
http://help.ubuntu.ru/wiki/7zip
p7zip-rar - Модуль для p7zip, даёт возможность распаковывать RAR-архивы.
p7zip-full - Консольный порт 7-Zip под POSIX системы.
Image

dyvniy M
Topic author, Администратор
Администратор
Avatar
dyvniy M
Topic author, Администратор
Администратор
Age: 36
Reputation: 1
Loyalty: 1
Posts: 3159
Joined: Wed, 10 Oct 2012
With us: 6 years 9 months
Профессия: Программист
Location: Россия, Москва
ICQ Website Skype VK

#4by dyvniy » Mon, 19 May 2014, 15:20:31

Запись контейнеров POD в файл и чтение из него
http://www.qtcentre.org/archive/index.php/t-27872.html
Spoiler

Code: Select all


QHash
<QString, QVariant> entries;

entries.insert("key1", 1);
entries.insert("key2", "seven");
entries.insert("key3", 22.7);

QFile fileOut("hashtest.dat");
if (fileOut.open(QIODevice::WriteOnly))
{
QDataStream out(&fileOut);
out.setVersion(QDataStream::Qt_4_6);

out << entries;
fileOut.flush();
fileOut.close();
}

QHash<QString, QVariant> inputs;

QFile fileIn("hashtest.dat");
if (fileIn.open(QIODevice::ReadOnly))
{
QDataStream in(&fileIn);
in.setVersion(QDataStream::Qt_4_6);

in >> inputs;

fileIn.close();
}
Image

dyvniy M
Topic author, Администратор
Администратор
Avatar
dyvniy M
Topic author, Администратор
Администратор
Age: 36
Reputation: 1
Loyalty: 1
Posts: 3159
Joined: Wed, 10 Oct 2012
With us: 6 years 9 months
Профессия: Программист
Location: Россия, Москва
ICQ Website Skype VK

#5by dyvniy » Fri, 23 May 2014, 16:25:38

Рекурсивный перебор файлов.
http://2lx.ru/2011/12/rekursivnyj-poisk-fajlov-na-qt/
Spoiler

Code: Select all

void ListDirRecursive(QString directory)
{
 QDir dir(directory);
 foreach(QString entry, dir.entryList())
 {
 if ((entry == ".") || (entry == ".."))
 continue;
 QDir subdir = QDir(dir.absoluteFilePath(entry));
 if (subdir.exists())
 ListDirRecursive(subdir.absolutePath());
 qDebug() << subdir.absolutePath();
 }
}

Code: Select all

void ListDirRecursive2(QString directory)
{
 
QDirIterator iterator (directoryQDir::Files QDir::NoSymLinksQDirIterator::Subdirectories);
 while(
iterator.hasNext())
 {
 
iterator.next();
 
qDebug() << iterator.fileInfo().absoluteFilePath();
 }

Image

dyvniy M
Topic author, Администратор
Администратор
Avatar
dyvniy M
Topic author, Администратор
Администратор
Age: 36
Reputation: 1
Loyalty: 1
Posts: 3159
Joined: Wed, 10 Oct 2012
With us: 6 years 9 months
Профессия: Программист
Location: Россия, Москва
ICQ Website Skype VK

#6by dyvniy » Tue, 15 Jul 2014, 08:33:39

Image


Forum name: Программирование (под Desktop и Android)
Description: Разработка и отладка приложений. Упор на 3D-графику.

Quick reply


Enter the code exactly as it appears. All letters are case insensitive.
Confirmation code
:) ;) :hihi: :P :hah: :haha: :angel: :( :st: :_( :cool: 8-| :beee: :ham: :rrr: :grr: :* :secret: :stupid: :music: View more smilies
   

Return to “Программирование (под Desktop и Android)”

Who is online (over the past 15 minutes)

Users browsing this forum: 1 guest