【发布时间】:2021-06-21 02:12:51
【问题描述】:
我正在寻找简单的解决方案,通过使用对话框从用户那里获取一些数据。
我不想使用 MFC,因为它应该是跨平台的。 我已经阅读并运行了一些 QT 和 wxWidgets 的示例,但问题是它们使用自己的“自己的”主入口点,所以我不知道如何在我的应用程序中组合它们。
这是我正在尝试做的一个示例:
int main()
{
std::cout << "Please choose the dialog! Press 1 or 2" << std::endl;
int key = 0;
std::cin >> key;
if (key == 1)
{
Dialog1 dlg; //This is my question! how to do that?
dlg.show();
//Get data drom dialog:
std::string str1 = dlg.GetData(ID_EDIT_BOX_1);
std::string str2 = dlg.GetData(ID_EDIT_BOX_2);
}
if (key == 2)
{
Dialog2 dlg;
dlg.show(); //Show simple dialog with some edit boxes
//Get data drom dialog:
std::string str1 = dlg.GetData(ID_EDIT_BOX_1);
std::string str2 = dlg.GetData(ID_EDIT_BOX_2);
}
}
我的意思是我知道如何创建和调用对话框,但不知道如何在我的应用程序中组合它们并以特定的方式调用它们 em> 行...
谢谢。
【问题讨论】:
-
见this 链接。它具有可以回读的字段。
-
@yonatan,你是应用程序控制台还是 GUI?
-
@Igor,它是一个控制台应用程序
-
@Yonatan,为什么要在控制台应用程序中显示 gui?并不是说它不能完成 - 只是很奇怪。
-
@Igor,实际上它是基于 opencv 的应用程序应该处理一些图像。我希望用户修改处理参数并用imshow得到结果...
标签: c++ qt user-interface cross-platform wxwidgets