本文整理汇总了C++中setOpen函数的典型用法代码示例。如果您正苦于以下问题:C++ setOpen函数的具体用法?C++ setOpen怎么用?C++ setOpen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setOpen函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: throw
void TreeViewItem::restoreOpennessState (const XmlElement& e) throw()
{
if (e.hasTagName ("CLOSED"))
{
setOpen (false);
}
else if (e.hasTagName ("OPEN"))
{
setOpen (true);
forEachXmlChildElement (e, n)
{
const String id (n->getStringAttribute ("id"));
for (int i = 0; i < subItems.size(); ++i)
{
TreeViewItem* const ti = subItems.getUnchecked(i);
if (ti->getUniqueName() == id)
{
ti->restoreOpennessState (*n);
break;
}
}
}
}
示例2: thisId
TreeViewItem* TreeViewItem::findItemFromIdentifierString (const String& identifierString)
{
const String thisId (getUniqueName());
if (thisId == identifierString)
return this;
if (identifierString.startsWith (thisId + "/"))
{
const String remainingPath (identifierString.substring (thisId.length() + 1));
bool wasOpen = isOpen();
setOpen (true);
for (int i = subItems.size(); --i >= 0;)
{
TreeViewItem* item = subItems.getUnchecked(i)->findItemFromIdentifierString (remainingPath);
if (item != 0)
return item;
}
setOpen (wasOpen);
}
return 0;
}
示例3: openPositions
bool TutFile::open(const QByteArray &data)
{
QList<quint32> positions;
quint32 dataSize = data.size();
positions = openPositions(data);
if(positions.isEmpty()) {
return false;
}
tutos.clear();
for(int i=0 ; i<positions.size()-1 ; ++i) {
if(positions.at(i) < dataSize && positions.at(i) < positions.at(i+1)) {
QByteArray t = data.mid(positions.at(i), positions.at(i+1)-positions.at(i));
// if(t.startsWith("KAO")) {
// t.prepend('A'); // PC bug
// }
// qDebug() << i << t.left(16).toHex();
tutos.append(t);
}
}
setOpen(true);
return true;
}
示例4: while
void TreeItem::insertNode(GNode * node)
{
nodeObj_ = node;
node->setGuiPtr(this);
// return;
QListIterator < GNode > it = QListIterator < GNode > (node->children());
while (it.current()) {
GNode *n = it.current();
#ifdef DEBUGMSG
qDebug("TreeItem: add %s\n", (const char *) n->name());
#endif
TreeItem *item = new TreeItem(this, n->name());
ASSERT(item!=0);
if (n->isA("SNode")) {
pixmap_.resize(20, 10);
pixmap_.fill(((SNode *) n)->color());
item->setPixmap(0, pixmap_);
}
#if 0
if (nodeObj_->isCompound())
item->setPixmap(0, *pixmap_compound);
else
item->setPixmap(0, *pixmap_generalize);
#endif
#ifdef DEBUGMSG
qDebug("TreeItem: done %s\n", (const char *) n->name());
#endif
item->insertNode(n);
++it;
}
setOpen(TRUE);
}
示例5: qDebug
void CDatabaseItem::setConnected(bool isconnected)
{
#ifdef DEBUG
qDebug("CDatabaseItem::setConnected(%s)", debug_string(booltostr(isconnected)));
#endif
if (isBlocked())
return;
setBlocked(true);
if (isconnected)
is_connected = isconnected && mysql()->mysql()->mysqlSelectDb(text(0));
else
is_connected = false;
setPixmap(0, is_connected ? databaseConnectedIcon : databaseDisconnectedIcon);
if (is_connected)
{
new CTableGroupItem(this, text(0), mysql());
setOpen(true);
}
else
deleteChilds();
createWindowMenu(consoleWindow()->itemToolBar());
setBlocked(false);
}
示例6: close
/**
* Override
* Open a connection to the database.
* @param db The name of the database which is to open.
* @param user A username of a database role.
* @param password The password to the username.
* @param host The host name or address where the database is home.
* @param port The port number to the database.
* @param connOpts Additional and optional options.
* @return True if database is open. Otherwise returns false.
*/
bool KQPostgreSqlDriver::open(const QString &db, const QString &user, const QString &password, const QString &host, int port, const QString &connOpts)
{
if (isOpen()) {
close();
}
QByteArray connectionInfo;
connectionInfo.append("host=").append(host).append(' ');
connectionInfo.append("port=").append(QString::number(port)).append(' ');
connectionInfo.append("dbname=").append(db).append(' ');
connectionInfo.append("user=").append(user).append(' ');
connectionInfo.append("password=").append(password);
if (! connOpts.isEmpty()) {
QString options = QString(connOpts).replace(QChar(';'), QChar(' '));
connectionInfo.append(' ').append(options);
}
m_connection = PQconnectdb(connectionInfo.data());
ConnStatusType status = PQstatus(m_connection);
if (status == CONNECTION_BAD) {
QSqlError error(QString("Could not open database !"), QString(PQerrorMessage(m_connection)), QSqlError::ConnectionError);
setLastError(error);
setOpenError(true);
PQfinish(m_connection);
m_connection = NULL;
return false;
}
setOpen(true);
setOpenError(false);
return true;
}
示例7: LazyFetchItem
WatchRoot::WatchRoot(VariableTree *parent)
: LazyFetchItem(parent)
{
setText(VAR_NAME_COLUMN, i18n("Watch"));
setOpen(true);
setSelectable(false);
}
示例8: mouseDoubleClick
void mouseDoubleClick (const MouseEvent& e) override
{
if (e.y < titleHeight) {
setOpen (! isOpen);
}
}
示例9: appendFromXML
/**
* @brief Overwritten drop handler
*
* @param evt the event
*/
void TreeEntry::dropped(QDropEvent *evt)
{
if (evt->provides("application/x-qpamat")) {
evt->accept();
QString xml = QString::fromUtf8(evt->encodedData("application/x-qpamat"));
QDomDocument doc;
doc.setContent(xml);
QDomElement elem = doc.documentElement();
Q3ListViewItem* src = reinterpret_cast<TreeEntry*>(elem.attribute("memoryAddress").toLong());
QpamatWindow *win = Qpamat::instance()->getWindow();
if (src == this) {
win->message(tr("Cannot dray to itself."));
return;
}
TreeEntry* item = m_isCategory ? this : dynamic_cast<TreeEntry*>(parent());
TreeEntry* appended = 0;
if (item)
appended = appendFromXML(item, elem);
else
appended = appendFromXML(listView(), elem);
if (!isOpen())
setOpen(true);
listView()->setSelected(appended, true);
dynamic_cast<Tree*>(listView())->updatePasswordStrengthView();
delete src;
}
}
示例10: QListViewItem
DriverItem::DriverItem(QListViewItem *parent, QListViewItem *after, DrBase *item) : QListViewItem(parent, after), m_item(item), m_conflict(false)
{
setOpen(depth() < 3);
if(item)
setPixmap(0, SmallIcon((item->isOption() ? "document" : "folder")));
updateText();
}
示例11: qDebug
int BulkController::close() {
if (!isOpen()) {
qDebug() << " device" << getName() << "already closed";
return -1;
}
qDebug() << "Shutting down USB Bulk device" << getName();
// Stop the reading thread
if (m_pReader == NULL) {
qWarning() << "BulkReader not present for" << getName()
<< "yet the device is open!";
} else {
disconnect(m_pReader, SIGNAL(incomingData(QByteArray, mixxx::Duration)),
this, SLOT(receive(QByteArray, mixxx::Duration)));
m_pReader->stop();
controllerDebug(" Waiting on reader to finish");
m_pReader->wait();
delete m_pReader;
m_pReader = NULL;
}
// Stop controller engine here to ensure it's done before the device is
// closed incase it has any final parting messages
stopEngine();
// Close device
controllerDebug(" Closing device");
libusb_close(m_phandle);
m_phandle = NULL;
setOpen(false);
return 0;
}
示例12: selectFile
bool selectFile (const File& target)
{
if (file == target)
{
setSelected (true, true);
return true;
}
if (target.isAChildOf (file))
{
setOpen (true);
for (int maxRetries = 500; --maxRetries > 0;)
{
for (int i = 0; i < getNumSubItems(); ++i)
if (FileListTreeItem* f = dynamic_cast <FileListTreeItem*> (getSubItem (i)))
if (f->selectFile (target))
return true;
// if we've just opened and the contents are still loading, wait for it..
if (subContentsList != nullptr && subContentsList->isStillLoading())
{
Thread::sleep (10);
rebuildItemsFromContentList();
}
else
{
break;
}
}
}
return false;
}
示例13: QListViewItem
StreamItem::StreamItem( QListView* parent, const QString& n ):
QListViewItem( parent, n )
{
name = n;
stream = 0;
setOpen( true );
}
示例14: close
/*
SQLite dbs have no user name, passwords, hosts or ports.
just file names.
*/
bool QSQLite2Driver::open(const QString & db, const QString &, const QString &, const QString &, int, const QString &)
{
if (isOpen())
close();
if (db.isEmpty())
return false;
char* err = 0;
d->access = sqlite_open(QFile::encodeName(db), 0, &err);
if (err) {
setLastError(QSqlError(tr("Error opening database"), QString::fromAscii(err),
QSqlError::ConnectionError));
sqlite_freemem(err);
err = 0;
}
if (d->access) {
setOpen(true);
setOpenError(false);
return true;
}
setOpenError(true);
return false;
}
示例15: s
void DriverItem::updateText()
{
if(m_item)
{
QString s(m_item->get("text"));
if(m_item->isOption())
s.append(QString::fromLatin1(": <%1>").arg(m_item->prettyText()));
if(m_item->type() == DrBase::List)
{
// remove all children: something has changed (otherwise this
// function would not be called), so it make sense to remove
// those children in all cases.
while(firstChild())
delete firstChild();
DrBase *ch = static_cast< DrListOption * >(m_item)->currentChoice();
if(ch && ch->type() == DrBase::ChoiceGroup)
{
// add new children
static_cast< DrChoiceGroup * >(ch)->createItem(this);
setOpen(true);
}
}
setText(0, s);
}
else
setText(0, "ERROR");
widthChanged();
}