Posts

c++ - Requires 2 right clicks to switch context menus among items? -

code below #include <qtwidgets> #include <qglwidget> int main(int argc, char *argv[]) { qapplication a(argc, argv); qmainwindow w; w.setcentralwidget(new qglwidget(&w)); // w.setcentralwidget(new qwidget(&w)); qtreewidget* tree = new qtreewidget(&w); qtreewidgetitem* item0 = new qtreewidgetitem(tree, qstringlist("a")); qtreewidgetitem* item1 = new qtreewidgetitem(tree, qstringlist("b")); tree->setcontextmenupolicy(qt::customcontextmenu); qobject::connect(tree, &qtreeview::customcontextmenurequested, [](){ qmenu menu; menu.addaction("a"); menu.exec(qcursor::pos()); }); qdockwidget* dock = new qdockwidget("tree", &w); dock->setwidget(tree); w.adddockwidget(qt::leftdockwidgetarea, dock); w.show(); return a.exec(); } compile , run it. requires 2 right clicks switch context menus among items. however, if change qglwidget ...

javascript onsubmit and 2 functions error -

can please tell me going wrong? i trying create basic login page , opens when correct password written <html> <head> <script> function validateform() { var x=document.forms["myform"]["fname"].value; if (x==null || x=="") { alert("first name must filled out"); return false; } var x=document.forms["myform"]["fname2"].value; if (x==null || x=="") { alert("password must filled out"); return false; } } function isvalid(mynorm){ var password = mynorm.value; if (password == "hello_me") { return true; } else {alert('wrong password') return false; } } </script> </head> <body> <form name="myform" action="helloworld.html" onsubmit="return !!(validateform()& isvalid())" method="post"> login id: <input type="text" name="fname"> <br /> <br> password: <...

jquery - InfoWindow not showing above Marker Google Maps JavaScript API v3 -

so have created jsfiddle demonstrating issue: http://jsfiddle.net/6vpc2/1/ hover on marker in jsfiddle see infowindow placement. i have googlemap "object" creates google maps. after creating google map so: var mapoptions = { zoom: 8, // initial zoom level when map loads (0-20) minzoom: 6, // minimum zoom level allowed (0-20) maxzoom: 17, // maximum soom level allowed (0-20) zoomcontrol: true, // set true if using zoomcontroloptions below, or false remove zoom controls. zoomcontroloptions: { style: google.maps.zoomcontrolstyle.default // change small force + , - buttons. }, //center: location, // centre map our coordinates variable maptypeid: google.maps.maptypeid.roadmap, // set type of map scrollwheel: false, // disable mouse scroll zooming (essential responsive sites!) // of below set true default, remove if set true: pancontrol: false, // set false disable maptypecontrol: false, // disable map/satellite swi...

python - call Django view function from django HTML template -

i have simple upload function in python have put in views.py. def upload(): global original_img,img,img2,img3,image_path,old_label_image,photo,label,image_path,image,ax,fig print "upload" image_path=tkfiledialog.askopenfilename() image = image.open(image_path) original_img= image.copy() image.thumbnail((1000,625)) photo = imagetk.photoimage(image) label = label(image=photo) label.image = photo if old_label_image not none: old_label_image.destroy() old_label_image = label label.pack() i want function called onclick of button html template file(current.html) in django. <button> upload pc</button> how call view function on click of button in html? have make changes in urlconfs this? please help in html, can use javascript's onlick way: <input type="button" onclick="window.location.href='/upload/'"> </input> note: "/upload/" red...

Expose mutable C++ object (float) to boost python -

i expose float object c++ code, boost python module. current attempt looks this: float timeinterval = 0.0f; ... boost_python_module(engine) { scope().attr("timeinterval") = object(ptr(&timeinterval)); ... } i found example here: https://wiki.python.org/moin/boost.python/howto#mutable_c.2b-.2b-_object however, appears used class instances , not primitives? i'm wondering if can expose primitive variable in similar manner , if so, how? tried see if def_readwrite available @ module level, , not.

twitter bootstrap - CSS not working in JSF 2.0 project -

Image
my jsf 2.0 web project isn't rendering graphics css. loads images cannot load background color or @ all. doing wrong here? css file contains code coloring , other things. using bootstrap. output page plain black , white. not see error messages in eclipse. <?xml version="1.0" encoding="utf-8"?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets"> <h:head> <f:facet name="meta-tags"> <meta content="text/html; charset=utf-8" http-equiv="content-type" /> <meta http-equiv="x-ua-compatible" content="ie=edge" /> <meta name="...

codeigniter - How do I Populate Multi Select drop dwon using php -

here listing cars.customers want compare car select drop down. person can select multiple cars. @ first time selecting 'audi' , saab' store data base next if came need populate saab , audi select how can using php <select name="cars" multiple> <option value="volvo">volvo</option> <option value="saab">saab</option> <option value="opel">opel</option> <option value="audi">audi</option> </select> here code <select id="cars" class="multiselect" multiple="multiple" name="cars[]"> <?php if($carslist->num_rows() >0) { foreach($carslist->result_array() $entry): ?> <option value="<?php echo($entry['id']); ?>" ><?php echo($entry['car_name']); ?></option> <?php ...