How to Change django-autocomplete-light input box styling? - django

I have gotten the autocomplete to work with my Database and my front end, but the input widget looks slightly off.
Is there a way to change the styling for the input?
Also, is there a way to remove the initial dropdown, so after you click once, you can start typing and suggestions will appear? I am using the ListSelect2 Widget. The Select2Multiple looks like more of what I need but I want input to be only one.
Current Widget Pre-Input
Current Widget During Input
Current Widget After Selection
Desired Look (Select2Multiple Widget)
I would appreciate any suggestions!

Related

How to focus on input after power-select-multiple is rendered?

I want to be able to search right after the webpage is rendered, instead of click on the search box then start typing.
However when I trying to mimic focusInput in original source code, it doesn't work.
It could be reproduced by visit
https://ember-power-select.com/docs/multiple-selection
and run document.querySelector('.ember-power-select-trigger-multiple-input').focus() which is focus on an input tag.
I expected to see something like this
, but actually nothing happened.
I also tried to .click() on all parent html elements of that input, but nothing happened
Any help?
I would suggest a tabindex to you. When you set the tabindex to 1 the search field will be the first to focus.
As an alternative you can try to achive this with an application instance initializer. In it you can now select the proper element and set the focus on it.

How to fill dynamic form fields using capybara

I have a form that contains a select box and a text field.
The text field is displayed dynamically based on the selectbox selection. If the value of selectbox is "Yes", then the text field will be displayed and vice versa.
I am running an rspec test and filled the select box value with "Yes"
select 'Yes', from: 'property[have_water_bills]'
Now i want to fill a value on the text field
fill_in 'property[irrigation_cycle_count]', with: 5
But i am getting the following error.
Capybara::ElementNotFound:
Unable to find field "property[irrigation_cycle_count]"
That is, capybara cannot find the dynamic element. Does anyone know how to fix this?
Poltergeist doesn't gemerate a click event when choosing an item from a select. It generates a focus on the option, change on the select, blur on the option. It is more like if a user selected the option with keyboard instead of using a mouse. You probably should be doing the logic to display your text field on the change event anyway so that it works if people use a mouse or a keyboard to navigate around your page. It also makes more sense to run your show/hide logic on the change event because that's what you actually care about, not clicks.
Finally got this to work using the following piece of code
page.execute_script("$('#have_water_bills').val('true').trigger('click')")

Save the current position/order in a QTabWidget when a button is clicked - User Settings

Is it possible to save the current tab position/order in a QTabWidget in Qt?
What I want is basically to be able to let the users arrange the tabs as they like and then let them save the position so when they open the application again the tabs are where they were when last saved.
In the past I have done this put this only saves the window geometry.
QSettings mySettings("someName", "MyApp");
mySettings.beginGroup("MainWindow");
mySettings.setValue("geometry", saveGeometry());
mySettings.endGroup()
;
Any idea how or where can I find the information to get this done?
Thanks
Apparently there is no built-in way to do it, so you need to implement it. I don't see any possible troubles with it.
For example, you may obtain the index of each widget using QTabWidget::indexOf, or you may iterate over all tabs and obtain widgets using QTabWidget::widget, depending on which way is more convenient in your app.
When starting the app, sort your widgets by saved index and add them to the tab widget in that order.

QTreeView: How to put multiple widgets in one cell?

I'd like to put multiple widgets in one cell of a QTreeView. QTreeView already does this with check boxes (e.g if you set ItemIsUserCheckable and ItemIsEditable). For example, how would I show a small tool button next to a line edit, instead of the check box next to the line edit?
I've gone through the whole deal of subclassing Qtreeview, implementing a custom ItemDelegate, and overriding paint( ) and createEditor( ). And that works if I only need to render simple things, like a single line edit, single button, etc. However, I cannot get it to work for nested components.
I tried to create a QHBoxLayout, add a QLineEdit and a QToolBarButton to it, add the layout to a new QWidget, and return the whole thing from createEditor( ). However, nothing shows up.
Can anybody provide a simple example?
Thanks!

unable to add a text field in cocos2d

i am developing a game using cocos2d framework. I want to add a text field to enter player's name. I used UITextField and the textfield is visible and the keyboard gets pop up. But my problem is the Return key is not working. I tried out many times but all in vain. please help me out, or is there any other way to add a text field in cocos2d. Thanx in advance.
Make sure that you implement all needed delegate methods for your text field. For example,
- (BOOL)textFieldShouldReturn:(UITextField *)textField
method.
did you use resignfirstresponder ? for returning keyboard just add the code as
[textfield resignFirstResponder];
also add this line of code on place where you want to return the keyboard such as on cctouchbegin or on click of any button. Hope this will work.