本文整理汇总了C++中Q_CHECK_PTR函数的典型用法代码示例。如果您正苦于以下问题:C++ Q_CHECK_PTR函数的具体用法?C++ Q_CHECK_PTR怎么用?C++ Q_CHECK_PTR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Q_CHECK_PTR函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: while
void menu::recurse(QMenu *cm, QFile &istr)
{
QString p1,p2,p3;
while(! istr.atEnd())
{
QTextStream til(istr.readLine(1024));
til >> p1; // command
if(p1.isEmpty() || p1 == "#")
continue;
if(p1 == "End")
return;
if(p1 == "Separator")
{
cm->addSeparator();
continue;
}
til >> p2; // menu label
if(p2.isEmpty())
continue;
p3 = til.readLine(); // command line
if(p2[0] == '"')
{
if(p2[p2.length()-1] != '"')
{
int i = p3.indexOf('"');
if(i == -1)
continue;
p2 += p3.left(i);
p2 = p2.mid(1, p2.length()-1);
p3 = p3.right(p3.length()-i-1);
}
else p2 = p2.mid(1, p2.length()-2);
}
if(p1 == "Menu")
{
QMenu *nm = new QMenu(p2);
Q_CHECK_PTR(nm);
cm->addMenu(nm);
recurse(nm, istr);
continue;
}
if(p1 == "Quit")
{
act_quit->setText(p2);
cm->addAction(act_quit);
continue;
}
if(p1 == "Kill")
{
act_kill->setText(p2);
cm->addAction(act_kill);
continue;
}
if(p1 == "Restart")
{
act_rest->setText(p2);
cm->addAction(act_rest);
continue;
}
if(p1 != "Entry")
continue;
p3 = p3.simplified();
if(p3.isEmpty())
continue;
QAction *act_run = new QAction(p2, cm);
act_run->setData(QVariant(p3));
cm->addAction(act_run);
}
}
开发者ID:nic0lae,项目名称:freebsddistro,代码行数:86,代码来源:menu.cpp
示例2: WatchItemBooleanConnector
WatchItemBase * ConnectorBoolIn::makeWatchItem()
{
WatchItemBase * wi = new WatchItemBooleanConnector(this);
Q_CHECK_PTR(wi);
return wi;
}
开发者ID:BackupTheBerlios,项目名称:ksimus,代码行数:6,代码来源:connectorboolin.cpp
示例3: subdivide_getPlugin
ScPlugin* subdivide_getPlugin()
{
SubdividePlugin* plug = new SubdividePlugin();
Q_CHECK_PTR(plug);
return plug;
}
开发者ID:piksels-and-lines-orchestra,项目名称:scribus,代码行数:6,代码来源:subdivide.cpp
示例4: switch
QWidget* OptionsDialog::getVariantWidget(const QVariant& v, const QString& message) {
QWidget* pwidget = NULL;
QLineEdit *plineedit = NULL;
QSpinBox *pspinbox;
QDoubleSpinBox *pdoublespinbox;
QCheckBox *pcheckbox;
QComboBox *pcombobox;
bool ok;
QRect rect;
QString currentitem;
QStringList combolist;
QStringList editlist;
InflowEditQListWidget *editlistwidget;
int currenti = -1, i = 0;
switch( v.type() ) {
case QVariant::String:
combolist = v.toString().split(",", QString::SkipEmptyParts);
if (combolist.count() > 1 ) {
pwidget = new QComboBox(this);
pcombobox = qobject_cast<QComboBox*>(pwidget);
Q_CHECK_PTR(pcombobox);
for( i = 0; i < combolist.count(); i++) {
currentitem = combolist.at(i);
if (currentitem.endsWith("+") ) {
currenti = i;
currentitem.chop(1);
}
pcombobox->addItem(currentitem);
}
if ( currenti >= 0 && currenti < pcombobox->count() ) {
pcombobox->setCurrentIndex( currenti );
}
break;
}
if ( v.toString().endsWith(";") ) {
editlist = v.toString().split(";", QString::SkipEmptyParts);
pwidget = new InflowEditQListWidget(this);
editlistwidget = (qobject_cast<InflowEditQListWidget*>(pwidget));
Q_CHECK_PTR( editlistwidget );
editlistwidget->buildWidget();
editlistwidget->setEditList(editlist);
break;
}
pwidget = new QLineEdit(v.toString() );
pwidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding );
//rect = pwidget->geometry();
//rect.setWidth(350);
//pwidget->setGeometry(rect);
if (message.contains(QRegExp(tr("contrase[nñ]a|password|clave|pin"),Qt::CaseInsensitive)) ) {
plineedit = qobject_cast<QLineEdit*>(pwidget);
Q_CHECK_PTR( plineedit );
plineedit->setEchoMode(QLineEdit::Password);
}
break;
case QVariant::Bool:
pwidget = new QCheckBox("",this);
pcheckbox = qobject_cast<QCheckBox*>(pwidget);
if ( v.toBool() ) {
pcheckbox->setCheckState(Qt::Checked);
}
else {
pcheckbox->setCheckState(Qt::Unchecked);
}
break;
case QVariant::Int:
pwidget = new QSpinBox();
pspinbox = qobject_cast<QSpinBox*>(pwidget);
pspinbox->setValue( v.toInt() );
break;
case QVariant::Double:
pwidget = new QDoubleSpinBox();
pdoublespinbox = qobject_cast<QDoubleSpinBox*>(pwidget);
pdoublespinbox->setValue( v.toDouble(&ok) );
break;
case QVariant::Date:
break;
case QVariant::DateTime:
break;
default:
break;
}
return pwidget;
}
开发者ID:Cenditel,项目名称:pysafet,代码行数:89,代码来源:optionsdialog.cpp
示例5: QButtonGroup
void NBioBSPRollDemo_Widget::Initialize()
{
//Create a groupbox which layouts its childs in a columns
// Device Function
gbox_Device = new QButtonGroup(0, QGroupBox::Vertical, "Device Function", this);
gbox_Device->setGeometry(5,7,520,60);
gbox_Device->setLineWidth(1);
lbl_Device = new QLabel("Device List", this);
//lbl_Device->setText("Device List");
lbl_Device->setGeometry(15,40,80,10);
cb_DEV_LIST = new QComboBox(FALSE, gbox_Device);
Q_CHECK_PTR(cb_DEV_LIST);
//cb_DEV_LIST->insertStrList(DeviceList, 1);
cb_DEV_LIST->setGeometry(100,25,250,30);
connect(cb_DEV_LIST, SIGNAL(activated(int)), this, SLOT(OnComboDeviceList()));
//cb_DEV_LIST->setCurrentItem(0);
m_DeviceID = NBioAPI_DEVICE_ID_AUTO;
pb_OPEN = new QPushButton("&Open", gbox_Device, "Open");
pb_OPEN->setGeometry(360, 25, 150, 30);
connect(pb_OPEN, SIGNAL(clicked()), this, SLOT(OnBtnOpenDevice()));
////////////////////////////////////////////////////////////////
// Capture Function
gbox_Capture = new QButtonGroup(0, QGroupBox::Vertical, "Capture Function", this);
gbox_Capture->setGeometry(5,90,490,355);
gbox_Capture->setLineWidth(1);
// Create a nice frame to put around the OpenGL widget
m_frmRoll = new QFrame(gbox_Capture, "CaptureFunction");
m_frmRoll->setFrameStyle(QFrame::Sunken | QFrame::Panel);
m_frmRoll->setLineWidth(1);
m_frmRoll->setGeometry(5, 25, 300, 300);
m_frmRoll->unsetPalette();
////////////////////////////////////////////////////////////////
// UI Setting
gbox_UISet = new QButtonGroup(0, QGroupBox::Vertical, "UI Setting", this);
gbox_UISet->setGeometry(310, 90, 565,140);
gbox_UISet->setLineWidth(1);
rb_DrawImageY = new QRadioButton("Yes,(Finger image drawing)", gbox_UISet, "rbDrawImageY");
rb_DrawImageY->setGeometry(5, 20, 260, 20);
connect(rb_DrawImageY, SIGNAL(clicked()), this, SLOT(OnRadioYes()));
rb_DrawImageY->setChecked(true);
m_ScanType = 1;
rb_DrawImageN = new QRadioButton("No,(Finger image drawing)", gbox_UISet, "rbDrawImageY");
rb_DrawImageN->setGeometry(5, 41, 260, 20);
connect(rb_DrawImageN, SIGNAL(clicked()), this, SLOT(OnRadioNo()));
gbox_UISet->setEnabled(false);
rb_DrawImageY->setEnabled(false);
rb_DrawImageN->setEnabled(false);
////////////////////////////////////////////////////////////////
// Roll Capture
gbox_Type2 = new QButtonGroup(0, QGroupBox::Vertical, "Roll Capture", this);
gbox_Type2->setGeometry(310, 170, 510, 200);
gbox_Type2->setLineWidth(1);
pb_RollStart = new QPushButton("&Roll Live Capture Start", gbox_Type2, "ppRollStart");
pb_RollStart->setGeometry(5, 20, 210, 30);
connect(pb_RollStart, SIGNAL(clicked()), this, SLOT(OnBtnStart()));
pb_RollStart->setEnabled(false);
////////////////////////////////////////////////////////////////
// Match
gbox_Match = new QButtonGroup(0, QGroupBox::Vertical, "VerifyMatch", this);
gbox_Match->setGeometry(310,270,520,270);
gbox_Match->setLineWidth(1);
pb_RollMatch = new QPushButton("&Verify Match", gbox_Match, "VerifyMatch");
pb_RollMatch->setGeometry(5, 20, 210, 30);
connect(pb_RollMatch, SIGNAL(clicked()), this, SLOT(OnBtnVerifyMatch()));
pb_RollMatch->setEnabled(false);
pb_EXIT = new QPushButton("&Exit", gbox_Match, "VerifyMatch");
pb_EXIT->setGeometry(5, 55, 210,30 );
connect(pb_EXIT, SIGNAL(clicked()), this, SLOT(OnBtnExit()));
}
开发者ID:brunopbaffonso,项目名称:ongonline,代码行数:82,代码来源:NBioBSPRollDemo.cpp
示例6: pathconnect_getPlugin
ScPlugin* pathconnect_getPlugin()
{
PathConnectPlugin* plug = new PathConnectPlugin();
Q_CHECK_PTR(plug);
return plug;
}
开发者ID:piksels-and-lines-orchestra,项目名称:scribus,代码行数:6,代码来源:pathconnect.cpp
示例7: scribusexportpixmap_getPlugin
ScPlugin* scribusexportpixmap_getPlugin()
{
PixmapExportPlugin* plug = new PixmapExportPlugin();
Q_CHECK_PTR(plug);
return plug;
}
开发者ID:JLuc,项目名称:scribus,代码行数:6,代码来源:export.cpp
示例8: pathfinder_getPlugin
ScPlugin* pathfinder_getPlugin()
{
PathFinderPlugin* plug = new PathFinderPlugin();
Q_CHECK_PTR(plug);
return plug;
}
开发者ID:pvanek,项目名称:scribus-cuba-1.5.0,代码行数:6,代码来源:pathfinder.cpp
示例9: parent
MatchScheduler::MatchScheduler(TopWidget *const &parent) :
parent(parent) {
Q_CHECK_PTR(parent);
qDebug() << parent;
}
开发者ID:KurtAhn,项目名称:Football-Simulator,代码行数:5,代码来源:MatchScheduler.cpp
示例10: lenseffects_getPlugin
ScPlugin* lenseffects_getPlugin()
{
LensEffectsPlugin* plug = new LensEffectsPlugin();
Q_CHECK_PTR(plug);
return plug;
}
开发者ID:AlterScribus,项目名称:ece15,代码行数:6,代码来源:lenseffects.cpp
示例11: Q_BASIC_ATOMIC_INITIALIZER
void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestName, const QHostAddress &nameserver, QDnsLookupReply *reply)
{
// Load dn_expand, res_ninit and res_nquery on demand.
static QBasicAtomicInt triedResolve = Q_BASIC_ATOMIC_INITIALIZER(false);
if (!triedResolve.loadAcquire()) {
QMutexLocker locker(QMutexPool::globalInstanceGet(&local_res_ninit));
if (!triedResolve.load()) {
resolveLibrary();
triedResolve.storeRelease(true);
}
}
// If dn_expand, res_ninit or res_nquery is missing, fail.
if (!local_dn_expand || !local_res_nclose || !local_res_ninit || !local_res_nquery) {
reply->error = QDnsLookup::ResolverError;
reply->errorString = tr("Resolver functions not found");
return;
}
// Initialize state.
struct __res_state state;
memset(&state, 0, sizeof(state));
if (local_res_ninit(&state) < 0) {
reply->error = QDnsLookup::ResolverError;
reply->errorString = tr("Resolver initialization failed");
return;
}
//Check if a nameserver was set. If so, use it
if (!nameserver.isNull()) {
if (nameserver.protocol() == QAbstractSocket::IPv4Protocol) {
state.nsaddr_list[0].sin_addr.s_addr = htonl(nameserver.toIPv4Address());
state.nscount = 1;
} else if (nameserver.protocol() == QAbstractSocket::IPv6Protocol) {
#if defined(Q_OS_LINUX)
struct sockaddr_in6 *ns;
ns = state._u._ext.nsaddrs[0];
// nsaddrs will be NULL if no nameserver is set in /etc/resolv.conf
if (!ns) {
// Memory allocated here will be free'd in res_close() as we
// have done res_init() above.
ns = (struct sockaddr_in6*) calloc(1, sizeof(struct sockaddr_in6));
Q_CHECK_PTR(ns);
state._u._ext.nsaddrs[0] = ns;
}
// Set nsmap[] to indicate that nsaddrs[0] is an IPv6 address
// See: https://sourceware.org/ml/libc-hacker/2002-05/msg00035.html
state._u._ext.nsmap[0] = MAXNS + 1;
state._u._ext.nscount6 = 1;
ns->sin6_family = AF_INET6;
ns->sin6_port = htons(53);
Q_IPV6ADDR ipv6Address = nameserver.toIPv6Address();
for (int i=0; i<16; i++) {
ns->sin6_addr.s6_addr[i] = ipv6Address[i];
}
#else
qWarning() << Q_FUNC_INFO << "IPv6 addresses for nameservers is currently not supported";
reply->error = QDnsLookup::ResolverError;
reply->errorString = tr("IPv6 addresses for nameservers is currently not supported");
return;
#endif
}
}
#ifdef QDNSLOOKUP_DEBUG
state.options |= RES_DEBUG;
#endif
QScopedPointer<struct __res_state, QDnsLookupStateDeleter> state_ptr(&state);
// Perform DNS query.
unsigned char response[PACKETSZ];
memset(response, 0, sizeof(response));
const int responseLength = local_res_nquery(&state, requestName, C_IN, requestType, response, sizeof(response));
// Check the response header.
HEADER *header = (HEADER*)response;
const int answerCount = ntohs(header->ancount);
switch (header->rcode) {
case NOERROR:
break;
case FORMERR:
reply->error = QDnsLookup::InvalidRequestError;
reply->errorString = tr("Server could not process query");
return;
case SERVFAIL:
reply->error = QDnsLookup::ServerFailureError;
reply->errorString = tr("Server failure");
return;
case NXDOMAIN:
reply->error = QDnsLookup::NotFoundError;
reply->errorString = tr("Non existent domain");
return;
case REFUSED:
reply->error = QDnsLookup::ServerRefusedError;
reply->errorString = tr("Server refused to answer");
return;
default:
reply->error = QDnsLookup::InvalidReplyError;
reply->errorString = tr("Invalid reply received");
return;
//.........这里部分代码省略.........
开发者ID:3163504123,项目名称:phantomjs,代码行数:101,代码来源:qdnslookup_unix.cpp
示例12: f
KisImageBuilder_Result PSDLoader::decode(const KUrl& uri)
{
// open the file
QFile f(uri.toLocalFile());
if (!f.exists()) {
return KisImageBuilder_RESULT_NOT_EXIST;
}
if (!f.open(QIODevice::ReadOnly)) {
return KisImageBuilder_RESULT_FAILURE;
}
dbgFile << "pos:" << f.pos();
PSDHeader header;
if (!header.read(&f)) {
dbgFile << "failed reading header: " << header.error;
return KisImageBuilder_RESULT_FAILURE;
}
dbgFile << header;
dbgFile << "Read header. pos:" << f.pos();
PSDColorModeBlock colorModeBlock(header.colormode);
if (!colorModeBlock.read(&f)) {
dbgFile << "failed reading colormode block: " << colorModeBlock.error;
return KisImageBuilder_RESULT_FAILURE;
}
dbgFile << "Read color mode block. pos:" << f.pos();
PSDResourceSection resourceSection;
if (!resourceSection.read(&f)) {
dbgFile << "failed reading resource section: " << resourceSection.error;
return KisImageBuilder_RESULT_FAILURE;
}
dbgFile << "Read resource section. pos:" << f.pos();
PSDLayerSection layerSection(header);
if (!layerSection.read(&f)) {
dbgFile << "failed reading layer section: " << layerSection.error;
return KisImageBuilder_RESULT_FAILURE;
}
// XXX: add all the image resource blocks as annotations to the image
dbgFile << "Read layer section. " << layerSection.nLayers << "layers. pos:" << f.pos();
// Get the right colorspace
QPair<QString, QString> colorSpaceId = psd_colormode_to_colormodelid(header.colormode,
header.channelDepth);
if (colorSpaceId.first.isNull()) return KisImageBuilder_RESULT_UNSUPPORTED_COLORSPACE;
// Get the icc profile!
const KoColorProfile* profile = 0;
if (resourceSection.resources.contains(PSDResourceSection::ICC_PROFILE)) {
ICC_PROFILE_1039 *iccProfileData = dynamic_cast<ICC_PROFILE_1039*>(resourceSection.resources[PSDResourceSection::ICC_PROFILE]->resource);
if (iccProfileData ) {
profile = KoColorSpaceRegistry::instance()->createColorProfile(colorSpaceId.first,
colorSpaceId.second,
iccProfileData->icc);
dbgFile << "Loaded ICC profile" << profile->name();
}
}
// Create the colorspace
const KoColorSpace* cs = KoColorSpaceRegistry::instance()->colorSpace(colorSpaceId.first, colorSpaceId.second, profile);
if (!cs) {
return KisImageBuilder_RESULT_UNSUPPORTED_COLORSPACE;
}
// Creating the KisImageWSP
m_image = new KisImage(m_doc->createUndoStore(), header.width, header.height, cs, "built image");
Q_CHECK_PTR(m_image);
m_image->lock();
// set the correct resolution
if (resourceSection.resources.contains(PSDResourceSection::RESN_INFO)) {
RESN_INFO_1005 *resInfo = dynamic_cast<RESN_INFO_1005*>(resourceSection.resources[PSDResourceSection::RESN_INFO]->resource);
if (resInfo) {
m_image->setResolution(POINT_TO_INCH(resInfo->hRes), POINT_TO_INCH(resInfo->vRes));
// let's skip the unit for now; we can only set that on the KoDocument, and krita doesn't use it.
}
}
// Preserve the duotone colormode block for saving back to psd
if (header.colormode == DuoTone) {
KisAnnotationSP annotation = new KisAnnotation("DuotoneColormodeBlock",
i18n("Duotone Colormode Block"),
colorModeBlock.data);
m_image->addAnnotation(annotation);
}
// read the projection into our single layer
if (layerSection.nLayers == 0) {
dbgFile << "Position" << f.pos() << "Going to read the projection into the first layer, which Photoshop calls 'Background'";
KisPaintLayerSP layer = new KisPaintLayer(m_image, i18n("Background"), OPACITY_OPAQUE_U8);
KisTransaction("", layer -> paintDevice());
PSDImageData imageData(&header);
//.........这里部分代码省略.........
开发者ID:crayonink,项目名称:calligra-2,代码行数:101,代码来源:psd_loader.cpp
示例13: inputDocument
KisImportExportFilter::ConversionStatus KisHeightMapExport::convert(const QByteArray& from, const QByteArray& to)
{
dbgFile << "HeightMap export! From:" << from << ", To:" << to;
if (from != "application/x-krita")
return KisImportExportFilter::NotImplemented;
KisDocument *inputDoc = inputDocument();
QString filename = outputFile();
if (!inputDoc)
return KisImportExportFilter::NoDocumentCreated;
if (filename.isEmpty()) return KisImportExportFilter::FileNotFound;
KisImageWSP image = inputDoc->image();
Q_CHECK_PTR(image);
if (inputDoc->image()->width() != inputDoc->image()->height()) {
inputDoc->setErrorMessage(i18n("Cannot export this image to a heightmap: it is not square"));
return KisImportExportFilter::WrongFormat;
}
if (inputDoc->image()->colorSpace()->colorModelId() != GrayAColorModelID) {
inputDoc->setErrorMessage(i18n("Cannot export this image to a heightmap: it is not grayscale"));
return KisImportExportFilter::WrongFormat;
}
KoDialog* kdb = new KoDialog(0);
kdb->setWindowTitle(i18n("HeightMap Export Options"));
kdb->setButtons(KoDialog::Ok | KoDialog::Cancel);
Ui::WdgOptionsHeightMap optionsHeightMap;
QWidget* wdg = new QWidget(kdb);
optionsHeightMap.setupUi(wdg);
kdb->setMainWidget(wdg);
QApplication::restoreOverrideCursor();
QString filterConfig = KisConfig().exportConfiguration("HeightMap");
KisPropertiesConfiguration cfg;
cfg.fromXML(filterConfig);
optionsHeightMap.intSize->setValue(image->width());
int endianness = cfg.getInt("endianness", 0);
QDataStream::ByteOrder bo = QDataStream::LittleEndian;
optionsHeightMap.radioPC->setChecked(true);
if (endianness == 0) {
bo = QDataStream::BigEndian;
optionsHeightMap.radioMac->setChecked(true);
}
if (!getBatchMode()) {
if (kdb->exec() == QDialog::Rejected) {
return KisImportExportFilter::UserCancelled;
}
}
if (optionsHeightMap.radioMac->isChecked()) {
cfg.setProperty("endianness", 0);
bo = QDataStream::BigEndian;
}
else {
cfg.setProperty("endianness", 1);
bo = QDataStream::LittleEndian;
}
KisConfig().setExportConfiguration("HeightMap", cfg);
bool downscale = false;
if (to == "image/x-r8" && image->colorSpace()->colorDepthId() == Integer16BitsColorDepthID) {
downscale = (QMessageBox::question(0,
i18nc("@title:window", "Downscale Image"),
i18n("You specified the .r8 extension for a 16 bit/channel image. Do you want to save as 8 bit? Your image data will not be changed."),
QMessageBox::Yes | QMessageBox::No)
== QMessageBox::Yes);
}
// the image must be locked at the higher levels
KIS_SAFE_ASSERT_RECOVER_NOOP(image->locked());
KisPaintDeviceSP pd = new KisPaintDevice(*image->projection());
QFile f(filename);
f.open(QIODevice::WriteOnly);
QDataStream s(&f);
s.setByteOrder(bo);
KisRandomConstAccessorSP it = pd->createRandomConstAccessorNG(0, 0);
bool r16 = ((image->colorSpace()->colorDepthId() == Integer16BitsColorDepthID) && !downscale);
for (int i = 0; i < image->height(); ++i) {
for (int j = 0; j < image->width(); ++j) {
it->moveTo(i, j);
if (r16) {
s << KoGrayU16Traits::gray(const_cast<quint8*>(it->rawDataConst()));
}
else {
//.........这里部分代码省略.........
开发者ID:ChrisJong,项目名称:krita,代码行数:101,代码来源:kis_heightmap_export.cpp
示例14: QDialog
BrushProperties::BrushProperties( QWidget *parent ) : QDialog( parent, "Brush Properties", true )
{
Q_CHECK_PTR( parent );
//Initializations
setCaption( tr( "Brush Properties" ) );
setFont( QFont( "helvetica", 10 ) );
parent_widget = parent;
resize( 235, 155 );
setMinimumSize( 235, 155 );
setMaximumSize( 235, 155 );
drawing_area = ( DrawingArea * )parent_widget;
//------------- Operations on the static texts ----------
text_origin = new QLabel( tr( "Origin Point" ) + QString( ":" ), this );
text_origin -> resize( 100, 20 );
text_origin -> move( 10, 10 );
text_origin_x = new QLabel( "X", this );
text_origin_x -> resize( 15, 20 );
text_origin_x -> move( text_origin -> x() + text_origin -> width() + 5, text_origin -> y() );
text_origin_y = new QLabel( "Y", this );
text_origin_y -> resize( 15, 20 );
text_origin_y -> move( text_origin_x -> x() + text_origin_x -> width() + 45, text_origin_x -> y() );
text_pattern = new QLabel( tr( "Border Style" ) + QString( ":" ), this );
text_pattern -> resize( 100, 20 );
text_pattern -> move( text_origin -> x(), text_origin -> y() + text_origin -> height() + 5 );
text_factor = new QLabel( tr( "Stipple Factor" ) + QString( ":" ), this );
text_factor -> resize( 100, 20 );
text_factor -> move( text_pattern -> x(), text_pattern -> y() + text_pattern -> height() + 5 );
text_angle = new QLabel( tr( "Rotation Angle" ) + QString( ":" ), this );
text_angle -> resize( 100, 20 );
text_angle -> move( text_factor -> x(), text_factor -> y() + text_factor -> height() + 5 );
//------------- Operations on the Textfields -------------
value_origin_x = new QLineEdit( this );
value_origin_x -> resize( 30, 20 );
value_origin_x -> move( text_origin_x -> x() + text_origin_x -> width() + 5, text_origin_x -> y() );
value_origin_y = new QLineEdit( this );
value_origin_y -> resize( 30, 20 );
value_origin_y -> move( text_origin_y -> x() + text_origin_y -> width() + 5, text_origin_y -> y() );
value_factor = new QLineEdit( this );
value_factor -> resize( 110, 20 );
value_factor -> move( text_factor -> x() + text_factor -> width() + 5, text_factor -> y() );
value_angle = new QLineEdit( this );
value_angle -> resize( 110, 20 );
value_angle -> move( text_angle -> x() + text_angle -> width() + 5, text_angle -> y() );
//------------- Operations on other components -------------
QStringList p_str;
p_str << "___________" << "_ _ _ _ _ _ _" << "_ _ _ _ _" << ". . . . . . . . ." << ". _ . _ . _ . _"
<< "___ ___ ___" << "___ _ ___ _" << "___ _ ___";
value_pattern = new QComboBox( this );
value_pattern -> insertStringList( p_str );
value_pattern -> resize( 110, 20 );
value_pattern -> move( text_pattern -> x() + text_pattern -> width() + 5, text_pattern -> y() );
//------------- Operations on the buttons -----------------
accept = new QPushButton( tr( "Accept" ), this );
accept -> resize( 60, 30 );
accept -> move( text_angle -> x() + 45, text_angle -> y() + text_angle -> height() + 10 );
connect( accept, SIGNAL( clicked() ), SLOT( slotAccept() ) );
cancel = new QPushButton( tr( "Cancel" ), this );
cancel -> resize( 60, 30 );
cancel -> move( accept -> x() + accept -> width() + 5, accept -> y() );
connect( cancel, SIGNAL( clicked() ), SLOT( slotCancel() ) );
}
开发者ID:BackupTheBerlios,项目名称:ktoon-svn,代码行数:79,代码来源:brushproperties.cpp
示例15: importvsd_getPlugin
ScPlugin* importvsd_getPlugin()
{
ImportVsdPlugin* plug = new ImportVsdPlugin();
Q_CHECK_PTR(plug);
return plug;
}
开发者ID:gyuris,项目名称:scribus,代码行数:6,代码来源:importvsdplugin.cpp
示例16: barcodegenerator_getPlugin
ScPlugin* barcodegenerator_getPlugin()
{
Barcode* plug = new Barcode();
Q_CHECK_PTR(plug);
return plug;
}
开发者ID:nitramr,项目名称:scribus,代码行数:6,代码来源:barcode.cpp
示例17: tableRow
//.........这里部分代码省略.........
}
// If min and max are the same, make them different
if ( min == max )
{
yParms->setAxle( min-1., max+1., 3 );
}
}
}
//--------------------------------------------------------------------------
// 1: Allow the user to change the axle parameters.
//--------------------------------------------------------------------------
if ( showDialogs
&& property()->boolean( "graphYUserRange" ) )
{
GraphLimitsDialog *dialog =
new GraphLimitsDialog( this, yParmsList, "graphLimitsDialog" );
checkmem( __FILE__, __LINE__, dialog, "GraphLimitsDialog dialog", 1 );
if ( dialog->exec() == QDialog::Accepted )
{
dialog->store();
}
delete dialog; dialog = 0;
}
//--------------------------------------------------------------------------
// 3: Draw each graph.
//--------------------------------------------------------------------------
// Set up the progress dialog.
int step = 0;
int steps = tableVars();
QString text(""), button("");
if ( lineGraphs )
{
translate( text, "BpDocument:Graphs:DrawingLineGraphs" );
}
else
{
translate( text, "BpDocument:Graphs:DrawingBarGraphs" );
}
translate( button, "BpDocument:Graphs:Abort" );
QProgressDialog *progress = new QProgressDialog(
QString( text ).arg( steps ), button, steps );
Q_CHECK_PTR( progress );
progress->setMinimumDuration( 0 );
progress->setProgress( 0 );
// Loop for each output variable: one graph is composed per output variable.
bool result = true;
for ( yid = 0, yParms = yParmsList->first();
yid < tableVars();
yid++ )
{
yVar = tableVar( yid );
// The yVar must be continuous.
if ( yVar->isContinuous() )
{
// Recompute nice Y axis
//min = ( yParms->m_axleMin < yParms->m_dataMin )
// ? yParms->m_axleMin
// : yParms->m_dataMin;
min = yParms->m_axleMin;
//max = ( yParms->m_axleMax > yParms->m_dataMax )
// ? yParms->m_axleMax
// : yParms->m_dataMax;
max = yParms->m_axleMax;
// If min and max are the same, make them different
tics = 11;
if ( min == max )
{
yParms->setAxle( min-1., max+1., 3 );
}
// Compose this graph.
if ( lineGraphs )
{
composeLineGraph( yid, xVar, yVar, zVar, xParms, yParms );
}
else
{
composeBarGraph( yid, xVar, yVar, xParms, yParms );
}
// Update progress dialog.
progress->setProgress( ++step );
qApp->processEvents();
if ( progress->wasCancelled() )
{
result = false;
break;
}
yParms = yParmsList->next();
}
}
// Cleanup and return.
delete progress; progress = 0;
delete xParms; xParms = 0;
delete yParmsList; yParmsList = 0;
return( result );
}
开发者ID:cbevins,项目名称:BehavePlus5,代码行数:101,代码来源:bpcomposegraphs.cpp
示例18: switch
void SdtpCatalogDataProvider::fetch(int type, void *param)
{
switch(type) {
case FoldersRecursive:
{
XFolder* parent = static_cast<XFolder*>(param);
Q_CHECK_PTR(parent);
QUrl url( QString(SDTP_URL_GETALLCATS) );
createRequest(url, FoldersRecursive, parent);
break;
}
case Folders:
{
XFolder* parent = static_cast<XFolder*>(param);
Q_CHECK_PTR(parent);
QUrl url( QString(SDTP_URL_GETCATS).arg(parent->id()) );
createRequest(url, Folders, parent);
break;
}
case Files:
{
XFolder* parent = static_cast<XFolder*>(param);
Q_CHECK_PTR(parent);
QUrl url( QString(SDTP_URL_GETFILES).arg(parent->id()) );
createRequest(url, Files, parent);
break;
}
case FileDetails:
{
XFile* file = static_cast<XFile*>(param);
Q_CHECK_PTR(file);
QUrl url( QString(SDTP_URL_GETDETAILS).arg(file->id()) );
createRequest(url, FileDetails, file);
break;
}
case Thumbnail:
{
XFile* file = static_cast<XFile*>(param);
Q_CHECK_PTR(file);
QUrl url( file->thumbLink() );
createRequest(url, Thumbnail, file);
break;
}
default:
qDebug("Unknown request type '%d'", static_cast<quint32>(type));
}
}
开发者ID:HackLinux,项目名称:eMule-IS-Mod,代码行数:63,代码来源:sdtpcatalogdataprovider.cpp
示例19: Q_CHECK_PTR
QString Calendar::getDayName()
{
CalendarModel * tmpCal = DataTheme.general.getCalendar();
Q_CHECK_PTR(tmpCal);
return tmpCal->getLevelName(0,(_day-1));
}
开发者ID:q4a,项目名称:attal,代码行数:6,代码来源:calendar.cpp
示例20: Q_CHECK_PTR
void OptionsDialog::doSaveConfs() {
MainWindow* mw = qobject_cast<MainWindow*>(parent());
Q_CHECK_PTR( mw );
TextEdit* te = mw->centraledit();
for( int i = 0; i < te->listConfs().count(); i++) {
QString wkey = te->listConfs().at(i)["namewidget"].toString();
QMap<QString,QWidget*> mymap = widgetmap [ wkey ];
QMap<QString,QVariant>& myconf = const_cast<QMap<QString,QVariant>&>(te->listConfs().at(i));
for(int j=0; j < mymap.keys().count(); j++) {
QWidget* pwidget = mymap.value( mymap.keys().at(j));
qDebug("...doSaveConfs()...(3)...mymap.keys().at(j): %s", qPrintable(mymap.keys().at(j)));
if (pwidget != NULL) {
// qDebug("...doSaveConfs()...(4).i=%d..mymap.keys().at(%d):%s", i, j, qPrintable(mymap.keys().at(j)));
// qDebug("...doSaveConfs()...(6)...te->listConfs().at(%d)[\"namewidget\"]=%s",i,
// qPrintable(te->listConfs().at(i)["namewidget"].toString()));
// qDebug("...doSaveConfs()...(10)...te->listConfs().at(i).count(): %d",
// te->listConfs().at(i).count());
if ( te->listConfs().at(i)[mymap.keys().at(j)].type() == QVariant::String ) {
// qDebug("...doSaveConfs()...(9)...");
QLineEdit* pedit = qobject_cast<QLineEdit*>(pwidget);
QString text = "";
if ( pedit == NULL) {
QComboBox* pcombo = qobject_cast<QComboBox*>(pwidget);
if ( pcombo == NULL ) {
InflowEditQListWidget* editlistwidget = (qobject_cast<InflowEditQListWidget*>(pwidget));
Q_CHECK_PTR( editlistwidget );
QString text = editlistwidget->editList().join(";");
text +=";";
myconf[mymap.keys().at(j)] = text;
qDebug("...OptionsDialog::doSaveConfs: |%s|",
qPrintable(text));
continue;
}
for(int k=0;k<pcombo->count();k++){
text += pcombo->itemText(k);
if (k == pcombo->currentIndex() ) text += "+";
text += ",";
}
text.chop(1);
// qDebug("...doSaveConfs()...(10)...combobox...text: %s", qPrintable(text));
myconf[mymap.keys().at(j)] = text;
} else {
QString text = (pedit)->text();
// qDebug("...doSaveConfs()...(8)...lineedit...text: %s", qPrintable(text));
myconf[mymap.keys().at(j)] = text;
}
}
else if (te->listConfs().at(i)[mymap.keys().at(j)].type() == QVariant::Int ) {
int value = (qobject_cast<QSpinBox*>(pwidget))->value();
myconf[mymap.keys().at(j)] = value;
}
else if (te->listConfs().at(i)[mymap.keys().at(j)].type() == QVariant::Bool ) {
Qt::CheckState state = (qobject_cast<QCheckBox*>(pwidget))->checkState();
myconf[mymap.keys().at(j)] = (state == Qt::Checked);
}
}
}
}
}
开发者ID:Cenditel,项目名称:pysafet,代码行数:67,代码来源:optionsdialog.cpp
注:本文中的Q_CHECK_PTR函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论