本文整理汇总了C++中QClipboard::blockSignals方法的典型用法代码示例。如果您正苦于以下问题:C++ QClipboard::blockSignals方法的具体用法?C++ QClipboard::blockSignals怎么用?C++ QClipboard::blockSignals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QClipboard
的用法示例。
在下文中一共展示了QClipboard::blockSignals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
~Private()
{
if (qgetenv("XDG_CURRENT_DESKTOP") == "GNOME") {
useStaticForNative = true;
QClipboard *cb = QApplication::clipboard();
cb->blockSignals(false);
}
}
示例2: Private
Private(QWidget *parent_,
KoFileDialog::DialogType dialogType_,
const QString caption_,
const QString defaultDir_,
const QString dialogName_)
: parent(parent_)
, type(dialogType_)
, dialogName(dialogName_)
, caption(caption_)
, defaultDirectory(defaultDir_)
, filterList(QStringList())
, defaultFilter(QString())
, useStaticForNative(false)
, hideDetails(false)
, swapExtensionOrder(false)
{
// Force the native file dialogs on Windows. Except for KDE, the native file dialogs are only possible
// using the static methods. The Qt documentation is wrong here, if it means what it says " By default,
// the native file dialog is used unless you use a subclass of QFileDialog that contains the Q_OBJECT
// macro."
#ifdef Q_OS_WIN
useStaticForNative = true;
#endif
// Non-static KDE file is broken when called with QFileDialog::AcceptSave:
// then the directory above defaultdir is opened, and defaultdir is given as the default file name...
//
// So: in X11, use static methods inside KDE, which give working native dialogs, but non-static outside
// KDE, which gives working Qt dialogs.
//
// Only show the GTK dialog in Gnome, where people deserve it
#ifdef HAVE_X11
if (qgetenv("KDE_FULL_SESSION").size() > 0) {
useStaticForNative = true;
}
if (qgetenv("XDG_CURRENT_DESKTOP") == "GNOME") {
useStaticForNative = true;
QClipboard *cb = QApplication::clipboard();
cb->blockSignals(true);
swapExtensionOrder = true;
}
#endif
}
示例3: main
int main(int argc, char **argv)
{
int action;
double timeout = 5.;
int argIndex, numArgs;
int interval;
char *endptr;
QString qstr;
QTime curTime = QTime::currentTime();
int timeStamp = 60000 * curTime.minute() + 1000 * curTime.second() +
curTime.msec();
for (argIndex = 1; argIndex < argc - 1 ; argIndex++) {
if (argv[argIndex][0] == '-'){
switch (argv[argIndex][1]){
case 't': /* timeout interval */
timeout = strtod(argv[++argIndex], &endptr);
if (endptr - argv[argIndex] < (int)strlen(argv[argIndex])) {
fprintf(stderr, "ERROR: imodsendevent - invalid timeout entry %s\n",
argv[argIndex]);
exit(3);
}
break;
case 'D': /* debug */
debugOut = 1;
break;
default:
fprintf(stderr, "ERROR: imodsendevent - invalid argument %s\n",
argv[argIndex]);
exit(3);
break;
}
} else
break;
}
numArgs = argc - argIndex;
if (numArgs < 2) {
fprintf(stderr, "ERROR: imodsendevent - Wrong number of arguments\n"
" Usage: imodsendevent [-t timeout] [-D] Window_ID action "
"[arguments]\n");
exit(3);
}
// Check the arguments for odd characters
winID = strtol(argv[argIndex], &endptr, 10);
if (endptr - argv[argIndex] < (int)strlen(argv[argIndex])) {
fprintf(stderr, "ERROR: imodsendevent - invalid characters in window ID"
" entry %s\n", argv[argIndex]);
exit(3);
}
action = strtol(argv[argIndex + 1], &endptr, 10);
if (endptr - argv[argIndex + 1] < (int)strlen(argv[argIndex + 1])) {
fprintf(stderr, "ERROR: imodsendevent - invalid characters in action "
"entry %s\n", argv[argIndex + 1]);
exit(3);
}
// Create the application
ImodSendEvent a(argc, argv);
setlocale(LC_NUMERIC, "C");
// Pack the arguments into a QString
timeStr.sprintf(" %d ", timeStamp);
timeStr = QString(argv[argIndex]) + timeStr;
cmdStr = QString(argv[argIndex + 1]);
for (; argIndex + 2 < argc; argIndex++)
cmdStr += QString(" ") + QString(argv[argIndex + 2]);
qstr = timeStr + cmdStr;
// Connect to the clipboard, start the timeout, and send the text
QClipboard *cb = QApplication::clipboard();
// Default for setText and text() is Clipboard mode
//cb->setSelectionMode(false);
cb->blockSignals(true);
QObject::connect(cb, SIGNAL(dataChanged()), &a, SLOT(clipboardChanged()));
cb->blockSignals(false);
// Start a timeout timer if the interval is not zero.
interval = (int)(1000. * timeout + 0.5);
if (interval > 0) {
// If this hack is defined and > 0, divide the total timeout into intervals
// of this length and retry sending message
#ifdef SENDEVENT_RETRY_HACK
if (SENDEVENT_RETRY_HACK > 0) {
retryLimit = interval / SENDEVENT_RETRY_HACK;
if (!retryLimit)
retryLimit = 1;
interval = SENDEVENT_RETRY_HACK;
}
#endif
a.startTimer(interval);
}
//.........这里部分代码省略.........