void MainWindow::on_showMoreButton_clicked() { if(currSelectedID.toInt() > 0){ QString imgPath = "images/"; QTableWidget *current = new QTableWidget; if(whatList){ ui->listOfSci->setHidden(1); imgPath += "scientists/"; current = ui->listOfSci; } else{ ui->listOfComps->setHidden(1); imgPath += "computers/"; current = ui->listOfComps; } imgPath += currSelectedID + ".jpg"; QPixmap thing(imgPath); ui->pictureLable->setScaledContents(true); ui->pictureLable->setPixmap(thing); displayConnections(currSelectedID); fillComboConn(); int row = currSelectedRow; ui->more1->setText(current->item(row, 1)->text()); ui->more2->setText(current->item(row, 2)->text()); ui->more3->setText(current->item(row, 3)->text()); ui->more4->setText(current->item(row, 4)->text()); ui->more5->setText(current->item(row, 5)->text()); ui->moreUI->setVisible(1); } return; }
wxConstraintOp widthOf(wxWindow *win) { wxConstraintOp thing(wxCONSTRAINT_OP_EDGE); thing.win = win; thing.edge = wxWidth; return thing; }
wxConstraintOp leftOf(wxWindow *win) { wxConstraintOp thing(wxCONSTRAINT_OP_EDGE); thing.win = win; thing.edge = wxLeft; return thing; }
int main() { std::string thing("Hello"); std::string word; //getline(std::cin, thing); int number = atoi(thing.c_str()); double double_number = atof(thing.c_str()); //getline(std::cin, word); word = "bird"; //std::cout << word << " | " << thing + "hi" << " | " << number + '1'; //std::cout << word[0] << std::endl; for(int i = word.size() - 1; i >= 0; i--){ std::cout << word[i]; } std::cout << std::endl; std::string reversed_word; int counter = 0; for(int i = word.size() - 1; i >= 0; i--){ std::cout << i << " " << counter << " " << word.size() << std::endl; reversed_word += word[i]; //reversed_word[counter++] = word[i]; } std::cout << reversed_word << std::endl; return 0; }
QVariant BtTreeModel::toolTipData(const QModelIndex &index) const { RecipeFormatter* whiskey = new RecipeFormatter(); switch(treeMask) { case RECIPEMASK: return whiskey->getToolTip(qobject_cast<Recipe*>(thing(index))); case STYLEMASK: return whiskey->getToolTip( qobject_cast<Style*>(thing(index))); case EQUIPMASK: return whiskey->getToolTip( qobject_cast<Equipment*>(thing(index))); case FERMENTMASK: return whiskey->getToolTip( qobject_cast<Fermentable*>(thing(index))); case HOPMASK: return whiskey->getToolTip( qobject_cast<Hop*>(thing(index))); case MISCMASK: return whiskey->getToolTip( qobject_cast<Misc*>(thing(index))); case YEASTMASK: return whiskey->getToolTip( qobject_cast<Yeast*>(thing(index))); default: return item(index)->name(); } return "TOOL!"; }
static int main_(int argc, char** argv) { char const* bundlePath = "superhero.properties"; if(argc > 1) { bundlePath = argv[1]; } #if 1 superhero thing("The Thing", 200, 99, 100); superhero batman("Batman", 100, 80, 95); # if 0 ff::writeln(std::cout, "Ben Grimm is ", thing); ff::fmtln(std::cout, "Bruce Wayne is {0}", batman); # else /* ? 0 */ ff::properties_bundle bundle_(bundlePath); bundle = &bundle_; ff::writeln(std::cout, "Ben Grimm is ", edna_1(thing)); ff::writeln(std::cout, "Ben Grimm is ", edna_2(thing)); #if !defined(STLSOFT_COMPILER_IS_BORLAND) /* Borland is messed up, and cannot handle the filter type mechanism */ && \ !defined(STLSOFT_COMPILER_IS_DMC) /* DMC++ gets confused and can't find any matches for c_str_data_a */ ff::writeln(std::cout, "Ben Grimm is ", edna_3(thing)); ff::writeln(std::cout, "Ben Grimm is ", edna_4(thing)); ff::writeln(std::cout, "Ben Grimm is ", edna_5(thing)); #endif /* compiler */ ff::fmtln(std::cout, "Bruce Wayne is {0}", edna_1(batman)); ff::fmtln(std::cout, "Bruce Wayne is {0}", edna_2(batman)); #if !defined(STLSOFT_COMPILER_IS_BORLAND) /* Borland is messed up, and cannot handle the filter type mechanism */ && \ !defined(STLSOFT_COMPILER_IS_DMC) /* DMC++ gets confused and can't find any matches for c_str_data_a */ ff::fmtln(std::cout, "Bruce Wayne is {0}", edna_3(batman)); ff::fmtln(std::cout, "Bruce Wayne is {0}", edna_4(batman)); ff::fmtln(std::cout, "Bruce Wayne is {0}", edna_5(batman)); #endif /* compiler */ bundle = NULL; # endif /* 0 */ #else /* ? 0 */ #if 0 std::string sink1, sink2; ff::fmt(ff::fmt(sink1, "{0}", 1), "{0}", 2); ff::write(ff::write(sink2, 1), 2); #endif /* 0 */ OutputDebugString(NULL); #endif /* 0 */ return EXIT_SUCCESS; }
NS_IMETHODIMP nsAppStartup::CreateChromeWindow2(nsIWebBrowserChrome *aParent, PRUint32 aChromeFlags, PRUint32 aContextFlags, nsIURI *aURI, PRBool *aCancel, nsIWebBrowserChrome **_retval) { NS_ENSURE_ARG_POINTER(aCancel); NS_ENSURE_ARG_POINTER(_retval); *aCancel = PR_FALSE; *_retval = 0; // Non-modal windows cannot be opened if we are attempting to quit if (mAttemptingQuit && (aChromeFlags & nsIWebBrowserChrome::CHROME_MODAL) == 0) return NS_ERROR_ILLEGAL_DURING_SHUTDOWN; nsCOMPtr<nsIXULWindow> newWindow; if (aParent) { nsCOMPtr<nsIXULWindow> xulParent(do_GetInterface(aParent)); NS_ASSERTION(xulParent, "window created using non-XUL parent. that's unexpected, but may work."); if (xulParent) xulParent->CreateNewWindow(aChromeFlags, mAppShell, getter_AddRefs(newWindow)); // And if it fails, don't try again without a parent. It could fail // intentionally (bug 115969). } else { // try using basic methods: /* You really shouldn't be making dependent windows without a parent. But unparented modal (and therefore dependent) windows happen in our codebase, so we allow it after some bellyaching: */ if (aChromeFlags & nsIWebBrowserChrome::CHROME_DEPENDENT) NS_WARNING("dependent window created without a parent"); nsCOMPtr<nsIAppShellService> appShell(do_GetService(NS_APPSHELLSERVICE_CONTRACTID)); if (!appShell) return NS_ERROR_FAILURE; appShell->CreateTopLevelWindow(0, 0, aChromeFlags, nsIAppShellService::SIZE_TO_CONTENT, nsIAppShellService::SIZE_TO_CONTENT, mAppShell, getter_AddRefs(newWindow)); } // if anybody gave us anything to work with, use it if (newWindow) { newWindow->SetContextFlags(aContextFlags); nsCOMPtr<nsIInterfaceRequestor> thing(do_QueryInterface(newWindow)); if (thing) CallGetInterface(thing.get(), _retval); } return *_retval ? NS_OK : NS_ERROR_FAILURE; }
QColor IconColors::dominantColor() const { const QImage img = m_icon.pixmap({32, 32}).toImage(); if(img.isNull()) { qWarning() << "wrong icon" << m_icon << m_icon.name(); return QColor(Qt::black); } const int tolerance = 10; QVector<uint> hue(360/tolerance, 0); #ifdef OUTPUT_PIXMAP_DEBUG QImage thing(img.size()+QSize(0,1), QImage::Format_ARGB32); thing.fill(Qt::white); #endif for (int w=0, cw=img.width(); w<cw; ++w) { for (int h=0, ch=img.height(); h<ch; ++h) { #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) const QColor c = img.pixelColor(w, h).toHsv(); #else const QColor c(img.pixel(w, h)); #endif if (c.value()>150 && c.saturation()>20 && c.hue()>=0 && c.alpha()>200) { hue[c.hue()/tolerance]++; #ifdef OUTPUT_PIXMAP_DEBUG // qDebug() << "adopting" << w << "x" << h << c.name() << c.hue(); // thing.setPixelColor(w, h, c); thing.setPixelColor(w, h, QColor::fromHsv(tolerance*(c.hue()/tolerance), 220, 220)); #endif } } } uint dominantHue = 0, biggestAmount = 0; for(int i=0; i<hue.size(); ++i) { if (hue[i]>biggestAmount) { biggestAmount = hue[i]; dominantHue = i; } } QColor ret = QColor::fromHsv((dominantHue*tolerance + tolerance/2) % 360, 255, 255); #ifdef OUTPUT_PIXMAP_DEBUG qDebug() << "dominant" << dominantHue << hue[dominantHue] << "~=" << ((100*hue[dominantHue])/(img.width()*img.height())) << "% " << iconName(); thing.setPixelColor(0, img.height(), ret); thing.save("/tmp/"+iconName()+".png"); #endif return ret; }
int main() { int i=0 ; int j=0 ; printf ("\nStarting main: i = %d, j = %d", i,j) ; thing(i,&j) ; /* first argument is a value, second is a pointer/* printf("\nEnd of main: i= %d, j = %d\n", i,j) ;/* i has not been incremented but j has becasue argument as ref to address*/ return 0; }
static int main_(int /* argc */, char** /*argv*/) { superhero thing("The Thing", 200, 99, 100); superhero batman("Batman", 100, 80, 95); #if !defined(STLSOFT_COMPILER_IS_BORLAND) /* Borland is messed up, and cannot handle the filter type mechanism */ && \ !defined(STLSOFT_COMPILER_IS_DMC) /* DMC++ gets confused and can't find any matches for c_str_data_a */ ff::writeln(std::cout, "Ben Grimm is ", thing); ff::fmtln(std::cout, "Bruce Wayne is {0}", batman); #endif /* compiler */ return EXIT_SUCCESS; }
static int main_(int /* argc */, char** /*argv*/) { superhero thing("The Thing", 200, 99, 100); extrasuperhero batman("Batman", 100, 80, 95); #ifdef FF_COMPILER_SUPPORTS_FILTER_TYPE ff::writeln(std::cout, "Ben Grimm is ", thing); ff::fmtln(std::cout, "Bruce Wayne is {0}", batman); #endif /* FF_COMPILER_SUPPORTS_FILTER_TYPE */ return EXIT_SUCCESS; }
int main(int argc, char** argv){ SlepcInitialize(&argc, &argv, PETSC_NULL, PETSC_NULL); thing t; PetscPrintf(PETSC_COMM_WORLD, "x before everything = %i\n", t.x); t = thing(2); PetscPrintf(PETSC_COMM_WORLD, "x after everything = %i\n", t.x); // int N; // VecGetSize(t.x, &N); SlepcFinalize(); }
void work() { std::unique_ptr<CopyNoSwappy> thing(new CopyNoSwappy); art::Wrapper<CopyNoSwappy> wrap(thing); std::unique_ptr<SwappyNoCopy> thing2(new SwappyNoCopy); art::Wrapper<SwappyNoCopy> wrap2(thing2); std::unique_ptr<std::vector<double> > thing3(new std::vector<double>(10,2.2)); assert(thing3->size() == 10); art::Wrapper<std::vector<double> > wrap3(thing3); assert(wrap3->size() == 10); assert(thing3.get() == 0); }
NS_IMETHODIMP MiroWindowCreator::CreateChromeWindow2( nsIWebBrowserChrome *parent, PRUint32 chromeFlags, PRUint32 contextFlags, nsIURI *uri, PRBool *cancel, nsIWebBrowserChrome **_retval) { nsCAutoString specString; if((chromeFlags & nsIWebBrowserChrome::CHROME_OPENAS_CHROME) == 0) { *cancel = PR_TRUE; *_retval = nsnull; if(uri) { uri->GetSpec(specString); if(mWindowCallback) { mWindowCallback((char*)specString.get(), mWindowCallbackData); } } else { log_warning("Trying to open window with no URI"); } } else { nsCOMPtr <nsIAppShellService> appShellService(do_GetService(NS_APPSHELLSERVICE_CONTRACTID)); if (!appShellService) { return NS_ERROR_FAILURE; } nsCOMPtr <nsIXULWindow> newWindow; nsCOMPtr <nsIAppShell> appShell(do_GetService(kAppShellCID)); appShellService->CreateTopLevelWindow(0, 0, chromeFlags, nsIAppShellService::SIZE_TO_CONTENT, nsIAppShellService::SIZE_TO_CONTENT, appShell, getter_AddRefs(newWindow)); if (newWindow) { newWindow->SetContextFlags(contextFlags); nsCOMPtr<nsIInterfaceRequestor> thing(do_QueryInterface(newWindow)); if (thing) { CallGetInterface(thing.get(), _retval); NS_IF_ADDREF(*_retval); } } } return NS_OK; }
void WebThings::thing(const char *name, const __FlashStringHelper *model, SetupFunc setup) { thing(name, ((char *)model)+PROGMEM_BOUNDARY, setup); }
TEST(StatusOr, TestStatusCtor) { StatusOr<int> thing(Status::CANCELLED); EXPECT_FALSE(thing.ok()); EXPECT_EQ(Status::CANCELLED, thing.status()); }
void mdeath::thing(monster *z) { monster thing(GetMType("mon_thing")); thing.spawn(z->posx(), z->posy()); g->add_zombie(thing); }
MyClass( int x ) { a = mongo::inConstructorChain(); b = thing(); }
TEST(StatusOr, TestValue) { const int i = 4; StatusOr<int> thing(i); EXPECT_EQ(i, thing.ValueOrDie()); }
void mdeath::thing(game *g, monster *z) { monster thing(g->mtypes[mon_thing]); thing.spawn(z->posx, z->posy); g->z.push_back(thing); }
TEST(StatusOr, TestPointerValueCtor) { const int i = 4; StatusOr<const int*> thing(&i); EXPECT_TRUE(thing.ok()); EXPECT_EQ(&i, thing.ValueOrDie()); }
void mdeath::thing(game *g, monster *z) { monster thing(g->mtypes[mon_thing]); thing.spawn(z->posx(), z->posy()); g->add_zombie(thing); }
another() : r(thing()) {}
TEST(StatusOr, TestPointerValue) { const int i = 0; StatusOr<const int*> thing(&i); EXPECT_EQ(&i, thing.ValueOrDie()); }
TEST(StatusOr, TestValueCtor) { const int i = 4; StatusOr<int> thing(i); EXPECT_TRUE(thing.ok()); EXPECT_EQ(i, thing.ValueOrDie()); }