osx - Platform-native preferences dialog with Qt on Mac, Gnome, KDE, and Windows -
On Mac and genomes, the native applications use an app preference dialog, which is applied immediately to the selected settings More on Windows (I think), preferences are applied when "Apply" or "OK" button is pressed.
Is there a QT GUI to do this for you, or what ( Q_WS_WIN
, Q_WS_MAC
, Q_WS_X11
) To handle, the code must include many #ifdef
in the code << P>
If you have done this like before (even #ifdef < / Code>), so how can you share the skeleton code as you closed it?
It seems that you have to spin your own. Here is an important part of our solution. It may be that if someone appears to be, I can also accept some things due to my professional rules that can break other applications. The toggle is a macro that can be defined at compile-time: YOUR_APP_APPLY_PREFERENCES_IMMEDIATELY
preferences_dialog.h
Class preferences Delog: Public QDialog {Q_OBJECT Public: Clear Preferences (... Various Logic ..., QWidget * Parents); Private Slots: Zero ModifyMap Languages (); Private: Nil Applicable Language Change (Constant QLIST & lt; Language & gt; and Languages, Const. QHash & lt; Language, Language & gt; and Rename); Zero starting (); #ifndef YOUR_APP_APPLY_PREFERENCES_IMMEDIATELY Public slots: Acceptance (); Private Slots: Recorded Dialogue (); Private: QList & lt; Language & gt; Pending_languages_; Quish and Lit; Linguistic, Linguistics & gt; Pending_language_renames_; #end if };
preferences_dialog.cpp
Include # "Forms / Preferences_dialogues." #include "ui_preferences_dialog.h" PreferencesDialog :: Preferences (... Various Logic ..., QWidget * Parents): QDialog (Parents), ... Various Initial ... {UI- & gt; SetupUi (this); Start (); } Zero Priorities Delog :: Approved Languageguard (Constant Qualit & amp; Links; Languages & gt; and Languages; Const. QHash & Lt; Linguistic, Language & gt; and Naming) {// Make a real change here, whether immediate or adjourned Go) Priority Preferences Dialog :: Start () {/ Minimize and Disable at Max Butt Qt :: Window Flag Flag = It-> Window flags (); Flags | = Qt :: Customize WindowHint; Flags & amp; = ~ Qt :: WindowMinMaxButtonsHint; SetWindowFlags (flags); // button is QDialogButtonBox, OK, Cancel, and Apply button #ifdef YOUR_APP_APPLY_PREFERENCES_IMMEDIATELY ui- & gt; Button-> Setable (wrong); #alse QPushButton * apply_button = ui- & gt; Button-> Button (apply QDialogButtonBox ::); Connect (apply_button, signal (clicked), slot (ApplyDialog ()); #endif} Zero Preferences Dialog :: ModifyMapLanguages () {// Get the Change; In my case, they are coming from a dialogue wizard from the LanguageSetupWizard wizard (map _-> languages (), true, this); Wizard.setWindowModality (QT :: WindowModal); If (QDialog :: Accepted == wizard.exec ()) {#ifdef YOUR_APP_APPLY_PREFERENCES_IMMEDIATELYLanguageChanges (wizard.languages), wizard.language_renames ()); #else Pending_languages_ = wizard.languages (); Pending_language_rame_man_jan_wizard.languagegrace (); #endif}} #ifndf YOUR_APP_APPLY_PREFERENCES_IMMEDIATELY ZERO PREFERENCES Dialog :: Apply dialog (if (! PENDED_Expensive_ISEPlay ()) {ApplyLanguage Change (Pending_Languages_, Pending_Language_Reman__);}} Zero Priority Delog :: Accept () {ApplyDialog ( ); QDialog :: Accept ();} #endif
Comments
Post a Comment