Пример #1
0
void ErrorMsg::showMsg(QString msg)
{
	LPTSTR buf;

	setText(msg);
	if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
			  FORMAT_MESSAGE_FROM_SYSTEM,
			  NULL, err, 0, (LPTSTR) (void *) &buf,
			  0, NULL) > 0) {
		QString msg = QString::fromWCharArray(buf);
		setInformativeText(QString("[%1] %2").arg(err).arg(msg));
		LocalFree(buf);
	} else {
		setInformativeText(QString("[%1]").arg(err));
	}

	exec();
}
Пример #2
0
void QMdMessageBox::exec(const QString &text,const QString &informtext,
                         Icon icon,StandardButton buttons,
                         StandardButton defbutton) {
    setText(text);
    setInformativeText(informtext);
    setIcon(icon);
    setStandardButtons(buttons);
    setDefaultButton(defbutton);
    QMessageBox::exec();
}
Пример #3
0
int QMessageBox::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDialog::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: buttonClicked((*reinterpret_cast< QAbstractButton*(*)>(_a[1]))); break;
        case 1: d_func()->_q_buttonClicked((*reinterpret_cast< QAbstractButton*(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 2;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QString*>(_v) = text(); break;
        case 1: *reinterpret_cast< Icon*>(_v) = icon(); break;
        case 2: *reinterpret_cast< QPixmap*>(_v) = iconPixmap(); break;
        case 3: *reinterpret_cast< Qt::TextFormat*>(_v) = textFormat(); break;
        case 4: *reinterpret_cast<int*>(_v) = QFlag(standardButtons()); break;
        case 5: *reinterpret_cast< QString*>(_v) = detailedText(); break;
        case 6: *reinterpret_cast< QString*>(_v) = informativeText(); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setText(*reinterpret_cast< QString*>(_v)); break;
        case 1: setIcon(*reinterpret_cast< Icon*>(_v)); break;
        case 2: setIconPixmap(*reinterpret_cast< QPixmap*>(_v)); break;
        case 3: setTextFormat(*reinterpret_cast< Qt::TextFormat*>(_v)); break;
        case 4: setStandardButtons(QFlag(*reinterpret_cast<int*>(_v))); break;
        case 5: setDetailedText(*reinterpret_cast< QString*>(_v)); break;
        case 6: setInformativeText(*reinterpret_cast< QString*>(_v)); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 7;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}