0

QT GUI デザインを模倣するために wxFormbuilder を使用していますが、常に理想的な結果を得ることができません。

質問は配置/レイアウトに関連しています。誰か手を貸してくれませんか?

ここではファイルを添付できないので、wxFormbuilder プロジェクト ファイルと qt-gui screenspot .png ファイルを以下のリンクにアップロードしました。

誰か時間があれば、ガイドをお願いします。

wxFrombuild プロジェクト ファイルと qt_gui .png ファイルはこちらにあります。http://www.2shared.com/file/62BJYq2l/help_dlg.html http://www.2shared.com/photo/uWl3XmRl/qt_GUI.html

4

1 に答える 1

0

あなたのデザインはかなり複雑です。私は wxFormbuilder を使用しません。レイアウトを「ハードコーディング」して、手動でフォームをセットアップするのが好きです。

そのため、その方法を説明する前に、いくつかのアドバイスがあります。

  • ok/cancel/help バーを別の場所に配置します (別の wxPanel に配置し、最後にダイアログにまとめます)。
  • OK/キャンセル/ヘルプ バーのテスト接続ボタンを移動します。
  • テスト接続ボタンは、レイアウトを設定するという点で、現時点ではひどい場所にあります
  • (オプション)名前/ホスト/データベースとユーザー名/パスワードの間でフォームを分割します。これらは別の場所で再利用できるサブユニットを表すためです

ここで、フォームを作成する方法を示します。getValue と setValue を実装させます。また、ツールバーに対して同様のことを行い ( を使用wxBoxSizer)、それらをまとめる必要があります (wxBoxSizer再び を使用)。

また、wxStaticBox

class ConnectionEditor
  : wxPanel
{
public:
  ConnectionEditor(wxWindow* parent);
  //
  void getValue(ConnectionSettings&);
  void setValue(ConnectionSettings const&);
private:
  wxTextCtrl*     name_;
  wxTextCtrl*     host_;
  wxTextCtrl*     database_;
  wxTextCtrl*     username_;
  wxTextCtrl*     password_;
  wxCheckBox*     save_password_;
};


wxTextCtrl* CreateTextControl(wxWindow* parent)
{
  return new wxTextCtrl(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(100, 20));
}

wxTextCtrl* CreateStaticText(wxWindow* parent, std::string const& text)
{
  return new wxStaticText(parent, wxID_ANY, text.c_str());
}


ConnectionEditor::ConnectionEditor(wxWindow* parent)
 : wxPanel(parent, wxID_ANY)
{
  this->name_ = CreateTextControl(this);
  this->host_ = CreateTextControl(this);
  this->database_ = CreateTextControl(this);
  this->username_ = CreateTextControl(this);
  this->password_ = CreateTextControl(this);
  this->save_password_ = new wxCheckBox(this, wxID_ANY, "on");
  //
  wxFlexGridSizer* sizer = new wxFlexGridSizer(6, 2, 5, ,5); // 6 rows, 2 cols, 5 spacing in between
  //
  sizer->Add(CreateStaticText(this, "Name"));
  sizer->Add(this->name_);
  sizer->Add(CreateStaticText(this, "Host"));
  sizer->Add(this->host_);
  sizer->Add(CreateStaticText(this, "Database"));
  sizer->Add(this->database_);
  sizer->Add(CreateStaticText(this, "Username"));
  sizer->Add(this->username_);
  sizer->Add(CreateStaticText(this, "Password"));
  sizer->Add(this->password_);
  sizer->Add(CreateStaticText(this, "Save Password"));
  sizer->Add(this->save_password_);
  //
  this->SetSizerAndFit(sizer);
}
于 2013-09-06T07:51:42.997 に答える