小编Mak*_*ata的帖子

仅更改功能上的特定默认参数

我正在使用qt,正在尝试使用该QInputDialog::getText()功能从用户那里获取输入,根据文档,该功能的定义为:

QString QInputDialog::getText(QWidget * parent, const QString & title, const QString & label, QLineEdit::EchoMode mode = QLineEdit::Normal, const QString & text = QString(), bool * ok = 0, Qt::WindowFlags flags = 0, Qt::InputMethodHints inputMethodHints = Qt::ImhNone)
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

bool ok=0;
newAddress = QInputDialog::getText(0,"Enter an Address to Validate",
                                       "Adress: comma separated (e.g Address line 1, Address line 2, City, Postal Code)"
                                       ,&ok);
Run Code Online (Sandbox Code Playgroud)

但我得到了错误:

error: no matching function for call to 'QInputDialog::getText(int, const char [29], const char …
Run Code Online (Sandbox Code Playgroud)

c++ qt qt5

13
推荐指数
2
解决办法
774
查看次数

如何在 Python 中创建自己的 map() 函数

我正在尝试在 python 中创建内置的 map() 函数。这是我的尝试:

def mapper(func, *sequences):
   if len(sequences) > 1:
       while True:
          list.append(func(sequences[0][0],sequences[0][0],))
       return list
   return list
Run Code Online (Sandbox Code Playgroud)

但我真的很困惑,因为如果用户给出例如 100 个参数,我该如何处理这些参数?

python list map-function

4
推荐指数
1
解决办法
6324
查看次数

标签 统计

c++ ×1

list ×1

map-function ×1

python ×1

qt ×1

qt5 ×1