I know that in any NN architecture, the input data are states, and at the output layer Q-functionality of each action. Tell me please, how to adjust all weights in this case?
Have a look at and read the paper Playing Atari with Deep Reinforcement Learning, which describes deep Q-learning (i.e. Q-learning with neural networks). In particular, have a look at algorithm 1 (on page 5). As it is usually the case in deep learning, gradient descent and back-propagation are used to update the parameters (or weights) of the neural network, but they also use another technique, the experience replay buffer, in order to improve the convergence and stability of the training process. In the paper Human-level control through deep reinforcement learning, apart from using the experience replay buffer, they also use a so-called target network to improve stability.